Normally closed (NC) contact in PLC Programming - Time & Space Complexity
We want to understand how the time it takes to check a normally closed contact changes as the program runs.
Specifically, how does the number of operations grow when the contact is checked repeatedly?
Analyze the time complexity of the following code snippet.
// Check if normally closed contact is active
IF NOT Input_NC THEN
Output := TRUE;
ELSE
Output := FALSE;
END_IF;
This code checks a normally closed contact input and sets an output based on its state.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Single logical check of the contact state.
- How many times: This check happens once each program scan cycle.
The operation is a simple check that does not depend on input size.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 1 check per scan |
| 100 | 1 check per scan |
| 1000 | 1 check per scan |
Pattern observation: The number of operations stays the same regardless of input size.
Time Complexity: O(1)
This means the time to check the normally closed contact stays constant no matter how many times the program runs.
[X] Wrong: "Checking a normally closed contact takes longer as more contacts are added."
[OK] Correct: Each contact check is independent and simple, so adding more contacts does not slow down checking one contact.
Understanding simple operations like checking a normally closed contact helps build a strong foundation for analyzing more complex PLC programs.
"What if we checked multiple normally closed contacts in a loop? How would the time complexity change?"
Practice
Normally Closed (NC) contact do in a PLC circuit?Solution
Step 1: Understand NC contact behavior
A Normally Closed contact is closed (conducts electricity) when the input is OFF.Step 2: Apply to PLC circuit
This means current flows through the NC contact when the input is not activated.Final Answer:
It allows current to flow when the input is OFF. -> Option AQuick Check:
NC contact closed when input OFF = B [OK]
- Confusing NC with Normally Open (NO) contact
- Thinking NC contact conducts when input is ON
- Assuming NC contact permanently blocks current
Solution
Step 1: Identify NC contact symbol
In ladder logic, NC contacts are shown as contacts with a slash or diagonal line through them.Step 2: Compare options
A contact symbol with a slash or line through it matches this description, while others represent different elements.Final Answer:
A contact symbol with a slash or line through it -> Option DQuick Check:
NC contact symbol has slash = C [OK]
- Choosing coil symbols instead of contact symbols
- Confusing NC with NO contact symbol
- Selecting symbols without slashes for NC
X controlling output Y:
--[ /X ]--( Y )--If input
X is OFF, what will be the state of output Y?Solution
Step 1: Understand NC contact behavior with input OFF
NC contact is closed when input X is OFF, so current flows through it.Step 2: Determine output state
Since the NC contact is closed, output Y coil is energized and turns ON.Final Answer:
Output Y will be ON -> Option CQuick Check:
NC contact closed when input OFF means output ON = A [OK]
- Assuming output is OFF when input is OFF
- Confusing NC with NO contact behavior
- Thinking output toggles without cause
Solution
Step 1: Analyze motor never stopping
If motor never stops, the stop control is not breaking the circuit as expected.Step 2: Check NC contact wiring
If the NC contact is wired as a Normally Open (NO) contact by mistake, pressing the stop button will not open the circuit, and the motor will keep running.Final Answer:
The NC contact is wired as a Normally Open (NO) contact by mistake. -> Option AQuick Check:
Motor never stops means NC contact wired as NO = D [OK]
- Blaming coil wiring instead of contact wiring
- Assuming button is stuck without checking wiring
- Ignoring wrong contact type
Solution
Step 1: Understand safety requirement for emergency stop
Emergency stop must stop machine immediately and safely if pressed or if wiring fails.Step 2: Explain NC contact advantage
NC contact is closed normally, so if wiring breaks or power is lost, circuit opens and machine stops safely.Final Answer:
Because if wiring fails or power is lost, the circuit opens and stops the machine safely. -> Option BQuick Check:
NC contact fails safe by opening circuit = A [OK]
- Thinking NC contacts keep machine running when pressed
- Choosing cost or installation ease over safety
- Confusing NC with NO contact behavior
Ready to prove it?
Pass the test and this pattern moves unknown
