Bird
Raised Fist0
PLC Programmingscripting~5 mins

Start-stop motor control in PLC Programming - Time & Space Complexity

Choose your learning style10 modes available
Time Complexity: Start-stop motor control
O(1)
Understanding Time Complexity

We want to understand how the time it takes for a start-stop motor control program to run changes as the program runs repeatedly.

Specifically, we ask: How does the program's execution time grow when it checks the motor state many times?

Scenario Under Consideration

Analyze the time complexity of the following code snippet.

// Simple start-stop motor control
IF StartButton THEN
  Motor := TRUE;
ELSIF StopButton THEN
  Motor := FALSE;
END_IF;

This code checks if the start or stop button is pressed and turns the motor on or off accordingly.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Checking the state of StartButton and StopButton inputs.
  • How many times: This check happens once every program scan cycle, repeating continuously.
How Execution Grows With Input

Each scan cycle runs the same checks once, regardless of how long the program runs.

Input Size (n)Approx. Operations
10 cycles10 checks
100 cycles100 checks
1000 cycles1000 checks

Pattern observation: The number of operations grows directly with the number of cycles, but each cycle does a fixed small amount of work.

Final Time Complexity

Time Complexity: O(1)

This means each program scan takes a constant amount of time, no matter how many times it runs.

Common Mistake

[X] Wrong: "The program takes longer as the motor runs longer because it checks more inputs."

[OK] Correct: The program checks the same inputs each cycle, so each cycle's work stays the same regardless of motor run time.

Interview Connect

Understanding how simple control logic runs repeatedly with fixed cost helps you explain how automation programs behave in real systems.

Self-Check

"What if we added a loop inside the program to check multiple sensors? How would the time complexity change?"

Practice

(1/5)
1. What is the main purpose of a start-stop motor control circuit in PLC programming?
easy
A. To reverse the motor direction when the Stop button is pressed
B. To run a motor only while the Start button is held down
C. To turn a motor on with a Start button and keep it running until a Stop button is pressed
D. To stop a motor automatically after a set time

Solution

  1. Step 1: Understand start-stop control basics

    Start-stop control uses two buttons: Start to turn on the motor, Stop to turn it off.
  2. Step 2: Identify motor running behavior

    The motor stays on after Start is pressed and released, until Stop is pressed.
  3. Final Answer:

    To turn a motor on with a Start button and keep it running until a Stop button is pressed -> Option C
  4. Quick Check:

    Start keeps motor running until Stop pressed = D [OK]
Hint: Motor runs after Start pressed, stops only when Stop pressed [OK]
Common Mistakes:
  • Thinking motor runs only while Start is held
  • Assuming motor stops automatically without Stop button
  • Confusing Stop button with reversing motor
2. Which of the following is the correct ladder logic symbol for a normally open (NO) Start pushbutton in a start-stop motor control?
easy
A. A contact that closes when the button is pressed
B. A contact that stays closed all the time
C. A contact that opens when the button is pressed
D. A coil that energizes the motor

Solution

  1. Step 1: Recall NO contact behavior

    A normally open (NO) contact is open by default and closes when pressed.
  2. Step 2: Match to Start button function

    The Start button is NO so it closes circuit when pressed to start motor.
  3. Final Answer:

    A contact that closes when the button is pressed -> Option A
  4. Quick Check:

    NO contact closes on press = B [OK]
Hint: Start button uses NO contact that closes on press [OK]
Common Mistakes:
  • Confusing NO with NC (normally closed)
  • Thinking Start button contact is always closed
  • Mixing coil symbol with contact symbol
3. Given this PLC ladder logic snippet for start-stop control:
Start NO ---[ ]---+---( ) Motor
Stop NC ----[ ]---|
Motor ---[ ]-------+

What happens when the Start button is pressed and then released, assuming the motor was off initially?
medium
A. Motor turns on and stays on until Stop is pressed
B. Motor turns on only while Start is pressed
C. Motor never turns on
D. Motor turns on and off repeatedly

Solution

  1. Step 1: Analyze Start button effect

    Pressing Start closes NO contact, energizing Motor coil.
  2. Step 2: Understand holding circuit

    Motor contact in parallel holds coil energized after Start released.
  3. Final Answer:

    Motor turns on and stays on until Stop is pressed -> Option A
  4. Quick Check:

    Holding circuit keeps motor on after Start release = A [OK]
Hint: Holding contact keeps motor on after Start release [OK]
Common Mistakes:
  • Thinking motor turns off immediately after Start release
  • Ignoring Stop button effect
  • Misreading holding contact function
4. In a start-stop motor control program, the motor never turns off when the Stop button is pressed. What is the most likely error?
medium
A. Motor coil is missing from the circuit
B. Start button contact is wired as normally closed (NC)
C. Holding contact is missing from the circuit
D. Stop button contact is wired as normally open (NO) instead of normally closed (NC)

Solution

  1. Step 1: Check Stop button wiring

    Stop button must be NC to break circuit when pressed.
  2. Step 2: Identify effect of NO Stop button

    If Stop is NO, pressing it does not open circuit, so motor stays on.
  3. Final Answer:

    Stop button contact is wired as normally open (NO) instead of normally closed (NC) -> Option D
  4. Quick Check:

    Stop must be NC to stop motor = C [OK]
Hint: Stop button must be NC to break motor circuit [OK]
Common Mistakes:
  • Wiring Stop as NO contact
  • Confusing Start and Stop button contacts
  • Forgetting holding contact role
5. You want to add an emergency stop (E-Stop) button to a start-stop motor control circuit that immediately stops the motor when pressed. Which is the best way to add it?
hard
A. Add the E-Stop as a normally open (NO) contact in parallel with the Start button
B. Add the E-Stop as a normally closed (NC) contact in series with the Stop button
C. Add the E-Stop as a coil that energizes the motor
D. Add the E-Stop as a normally open (NO) contact in series with the motor coil

Solution

  1. Step 1: Understand emergency stop function

    E-Stop must break power immediately to stop motor safely.
  2. Step 2: Choose wiring method

    Placing E-Stop as NC contact in series with Stop button breaks circuit when pressed.
  3. Final Answer:

    Add the E-Stop as a normally closed (NC) contact in series with the Stop button -> Option B
  4. Quick Check:

    E-Stop NC in series cuts motor power = A [OK]
Hint: E-Stop wired NC in series to cut motor power immediately [OK]
Common Mistakes:
  • Wiring E-Stop as NO contact
  • Placing E-Stop in parallel with Start button
  • Using E-Stop as coil instead of contact
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard