Bird
Raised Fist0
PLC Programmingscripting~5 mins

Star-delta starter using timers in PLC Programming - Time & Space Complexity

Choose your learning style10 modes available
Time Complexity: Star-delta starter using timers
O(n)
Understanding Time Complexity

We want to understand how the time it takes for a star-delta starter program to run changes as we adjust timer settings.

Specifically, how does the program's execution scale with the timer delays involved?

Scenario Under Consideration

Analyze the time complexity of the following star-delta starter PLC code using timers.


// Star-delta starter sequence using timers
IF StartButton THEN
  StarCoil := TRUE;
  TimerStar(IN:=StarCoil, PT:=T#5s);
  IF TimerStar.Q THEN
    StarCoil := FALSE;
    DeltaCoil := TRUE;
    TimerDelta(IN:=DeltaCoil, PT:=T#3s);
  END_IF;
  IF TimerDelta.Q THEN
    DeltaCoil := FALSE;
  END_IF;
END_IF;
    

This code controls motor starting by first energizing the star coil for 5 seconds, then switching to the delta coil for 3 seconds using timers.

Identify Repeating Operations

Look for loops or repeated checks in the code.

  • Primary operation: The program continuously checks timer states each scan cycle.
  • How many times: The timer checks happen every scan while the start button is pressed and timers are running.
How Execution Grows With Input

The program runs in a loop, checking timers each scan. The total time depends on timer durations.

Timer Duration (seconds)Approx. Scan Checks
5 + 3 = 8About 8 seconds worth of scans
10 + 6 = 16About 16 seconds worth of scans
50 + 30 = 80About 80 seconds worth of scans

Pattern observation: The number of timer checks grows linearly with the total timer duration set.

Final Time Complexity

Time Complexity: O(n)

This means the program's running time grows linearly with the total timer duration set in the star-delta sequence.

Common Mistake

[X] Wrong: "The timers cause the program to run in constant time regardless of duration."

[OK] Correct: The PLC scans repeatedly check timer states, so longer timer durations mean more scan cycles and more operations.

Interview Connect

Understanding how timer delays affect program execution helps you design efficient control logic and explain timing behavior clearly in real projects.

Self-Check

What if we added a loop to repeat the star-delta sequence multiple times? How would the time complexity change?

Practice

(1/5)
1. What is the main purpose of using timers in a star-delta starter circuit?
easy
A. To control the time the motor stays connected in star and delta modes
B. To increase the motor speed instantly
C. To change the motor direction automatically
D. To measure the motor temperature

Solution

  1. Step 1: Understand star-delta starter function

    The star-delta starter reduces starting current by initially connecting the motor in star mode, then switching to delta mode.
  2. Step 2: Role of timers in this process

    Timers control how long the motor stays in star mode before switching to delta mode to ensure smooth transition and reduce electrical stress.
  3. Final Answer:

    To control the time the motor stays connected in star and delta modes -> Option A
  4. Quick Check:

    Timers control connection time = A [OK]
Hint: Timers manage star and delta connection duration [OK]
Common Mistakes:
  • Thinking timers increase motor speed
  • Confusing timers with direction control
  • Assuming timers measure temperature
2. Which of the following is the correct way to declare a timer in a PLC program for star-delta starting?
easy
A. TIMER Timer1 (START=Start, TIME=5s, DONE=Done)
B. TON Timer1 (IN:=Start, PT:=T#5s, Q=>Done)
C. TON Timer1(IN:=Start, PT:=T#5s, Q=>Done);
D. Timer1 = TON(Start, 5)

Solution

  1. Step 1: Identify correct timer syntax in PLC

    In IEC 61131-3 standard, TON timers are declared with input IN, preset time PT, and output Q using := and => operators.
  2. Step 2: Compare options

    TON Timer1 (IN:=Start, PT:=T#5s, Q=>Done) uses correct syntax: TON Timer1 (IN:=Start, PT:=T#5s, Q=>Done). Others have syntax errors or incorrect format.
  3. Final Answer:

    TON Timer1 (IN:=Start, PT:=T#5s, Q=>Done) -> Option B
  4. Quick Check:

    Correct IEC timer syntax = B [OK]
Hint: Use TON with IN:=, PT:=, Q=> for timers [OK]
Common Mistakes:
  • Using incorrect assignment operators
  • Missing time format T#5s
  • Adding semicolons inside declarations
3. Given the following PLC code snippet for a star-delta starter:
IF Start THEN
  TimerStar(IN:=TRUE, PT:=T#10s);
  IF TimerStar.Q THEN
    TimerDelta(IN:=TRUE, PT:=T#5s);
  END_IF
END_IF

What is the output state of TimerDelta.Q after 12 seconds of Start being TRUE?
medium
A. TRUE
B. TimerDelta.Q resets to FALSE
C. Undefined
D. FALSE

Solution

  1. Step 1: Analyze TimerStar behavior

    TimerStar starts when Start is TRUE and runs for 10 seconds. After 10 seconds, TimerStar.Q becomes TRUE.
  2. Step 2: Analyze TimerDelta behavior after TimerStar.Q

    Once TimerStar.Q is TRUE (after 10s), TimerDelta starts and runs for 5 seconds. At 12 seconds, TimerDelta has been running for 2 seconds, so TimerDelta.Q is still FALSE. But the code only sets TimerDelta.IN to TRUE when TimerStar.Q is TRUE, so TimerDelta is active.
  3. Step 3: Re-examine timing

    At 12 seconds, TimerDelta has been running for 2 seconds (less than 5s), so TimerDelta.Q is FALSE.
  4. Final Answer:

    FALSE -> Option D
  5. Quick Check:

    TimerDelta.Q after 2s < 5s = FALSE [OK]
Hint: Timer output Q is TRUE only after preset time PT [OK]
Common Mistakes:
  • Assuming TimerDelta.Q is TRUE immediately
  • Ignoring timer preset times
  • Confusing timer input IN with output Q
4. Identify the error in this star-delta timer PLC code snippet:
IF Start THEN
  TimerStar(IN:=Start, PT:=T#10s);
  IF TimerStar.Q THEN
    TimerDelta(IN:=Start, PT:=T#5s);
  END_IF
END_IF

What is the main problem?
medium
A. TimerDelta never starts because IN is tied to Start, not TimerStar.Q
B. TimerStar timer preset time is too short
C. Start input is not used correctly
D. Timers are missing reset logic

Solution

  1. Step 1: Check TimerStar input

    TimerStar.IN is correctly tied to Start, so it runs when Start is TRUE.
  2. Step 2: Check TimerDelta input

    TimerDelta.IN is tied to Start, not TimerStar.Q. This means TimerDelta starts immediately with Start, not after TimerStar.Q becomes TRUE.
  3. Step 3: Identify the problem

    TimerDelta should start only after TimerStar.Q is TRUE to ensure star mode completes before delta starts. Current code starts TimerDelta too early.
  4. Final Answer:

    TimerDelta never starts because IN is tied to Start, not TimerStar.Q -> Option A
  5. Quick Check:

    TimerDelta.IN must depend on TimerStar.Q [OK]
Hint: TimerDelta.IN should depend on TimerStar.Q, not Start [OK]
Common Mistakes:
  • Linking TimerDelta.IN directly to Start
  • Ignoring timer sequence dependencies
  • Not resetting timers properly
5. You want to design a star-delta starter PLC program where the motor starts in star mode for 8 seconds, then switches to delta mode for 10 seconds, and finally stops. Which timer logic sequence correctly achieves this?
hard
A. Start triggers both TimerStar and TimerDelta simultaneously, motor stops after 18s
B. Start triggers TimerDelta (10s), when TimerDelta.Q is TRUE start TimerStar (8s), then stop motor
C. Start triggers TimerStar (8s), when TimerStar.Q is TRUE start TimerDelta (10s), when TimerDelta.Q is TRUE stop motor
D. Start triggers TimerStar (8s), motor stops immediately after TimerStar.Q is TRUE

Solution

  1. Step 1: Understand star-delta timing sequence

    The motor must start in star mode for 8 seconds, then switch to delta mode for 10 seconds, then stop.
  2. Step 2: Analyze options

    Start triggers TimerStar (8s), when TimerStar.Q is TRUE start TimerDelta (10s), when TimerDelta.Q is TRUE stop motor correctly sequences timers: TimerStar runs first, then TimerDelta starts after TimerStar.Q is TRUE, then motor stops after TimerDelta.Q is TRUE.
  3. Step 3: Eliminate incorrect options

    Start triggers TimerDelta (10s), when TimerDelta.Q is TRUE start TimerStar (8s), then stop motor reverses sequence, Start triggers both TimerStar and TimerDelta simultaneously, motor stops after 18s runs timers simultaneously (wrong), Start triggers TimerStar (8s), motor stops immediately after TimerStar.Q is TRUE stops motor too early.
  4. Final Answer:

    Start triggers TimerStar (8s), when TimerStar.Q is TRUE start TimerDelta (10s), when TimerDelta.Q is TRUE stop motor -> Option C
  5. Quick Check:

    Sequential timers for star then delta = C [OK]
Hint: Chain timers: star first, then delta, then stop [OK]
Common Mistakes:
  • Starting timers simultaneously
  • Reversing star and delta order
  • Stopping motor too early
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