Detect Voltage Sag Events From RMS Meter Samples

Last updated: November 29, 2026

Quick Overview

Given time-ordered RMS voltage samples from a power meter and the nominal voltage, return every sag event: a run of at least k consecutive samples below 90% of nominal, reported as start time, end time and the deepest voltage.

Schneider Electric
Coding & Algorithms
Software Engineer
Schneider Electric
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given time-ordered RMS voltage samples from a power meter and the nominal voltage, return every sag event: a run of at least k consecutive samples below 90% of nominal, reported as start time, end time and the deepest voltage.

Power quality monitoring is a core feature of PowerLogic meters and EcoStruxure Power Monitoring Expert, so a short run-detection problem on voltage data is a natural phone screen warm-up. The interviewer checks clean single-pass state handling, the end-of-input case, and whether you think about the domain (thresholds, hysteresis, sampling rate).

What the Interviewer Expects
  • Single pass over samples with O(1) extra state
  • Correctly closes a run that ends at the last sample
  • Applies the minimum-duration filter so one-sample dips are ignored
  • Tracks the minimum voltage inside each event
  • Mentions hysteresis to avoid chattering at the threshold
Key Topics to Cover
run-length detection
streaming state machine
power quality
IEC 61000-4-30
edge cases
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you add hysteresis so an event only ends when voltage recovers above 92%?
  • Samples arrive as a stream from many meters. How do you keep per-meter state?
  • How would you also report swells (above 110%) and interruptions (below 10%) in one pass?
  • What changes if samples can be missing or out of order?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: samples as (t, v_rms) sorted by time, nominal (for example 230 V), threshold fraction (0.9) and min_samples k. Output: list of (start_t, end_t, min_v) for each qualifying run. A sampl...

High-Level Design

This is a run-length scan. Keep start, a run length and the running minimum. When a sample goes below the limit, open or extend the run. When it recovers, close the run and emit it if it lasted at l...


Submit Your Answer
Markdown supported

Related Questions