DEV Community

GeunWooJeon
GeunWooJeon

Posted on

Predictive Maintenance Simulation of a Flyback Converter Using Machine Learning (Isolation Forest)

Project Overview & Hardware Environment Setup (PSIM)

This project implements a Predictive Maintenance (PdM) system by extracting PSIM simulation data and applying the 'Isolation Forest' unsupervised learning algorithm within a VS Code environment.

  • Circuit Configuration: I designed a Flyback Converter to operate in Discontinuous Conduction Mode (DCM).
  • Fault Simulation: I simulated the Equivalent Series Resistance (ESR) characteristics by adding a series resistor (R) to the output capacitor (C). Data was collected and trained by varying the ESR values across different stages of aging and failure: 0.01Ω (Normal), 0.05Ω (Warning), and 0.1Ω (Fault).

Signal Processing & Data Preprocessing (Utilizing FFT and Harmonics)

Because actual field environments introduce various types of real-world noise, it is essential to target and analyze specific frequencies using FFT (Fast Fourier Transform) rather than relying on simple time-domain graphs.

  • FFT Graph Interpretation: The X-axis represents frequency (Hz), and the Y-axis represents the Vo ripple value. As the capacitor's ESR increases, the output ripple value (Y-axis) increases, and the peaks become much sharper.
  • The Engineering Value of Harmonics: Peaks occur not only at the 100kHz main frequency but also at multiples like 200kHz and 300kHz. These are inevitable harmonics because the circuit is driven by a square wave.
  • Not Just "Noise" to Discard: These harmonics are not simple errors. They are crucial clues for analyzing faults or making design decisions like, "A filter is needed here," or "This filter is working well." Because the shape of the harmonics changes as ESR increases, they should never be discarded but actively utilized so the AI can detect faults.

Machine Learning AI Modeling (Pipeline & Model Selection)

The overall data processing pipeline was structured as follows:

  • Pipeline: PSIM Data Collection -> DC (0Hz) component removal via Python FFT -> Feature extraction of the target frequency band (Preprocessing/Refining) -> Machine Learning (AI Modeling) -> Output as 1 (Normal) and -1 (Anomaly).
  • Why Unsupervised Learning (Isolation Forest)?: The reason I didn't use deep learning lies in the nature of industrial environments. In the actual field, collecting "fault" data is extremely difficult. Therefore, I needed an algorithm capable of quickly and lightly isolating anomalies using only normal data. This project confirmed the importance of having the insight to select the right AI model for a specific real-world situation. (Note: The current code only diagnoses at 100kHz, but analyzing multiple frequency bands is entirely possible with minor code modifications).

The Engineer's Dilemma & Contamination (Adjusting AI Sensitivity)


[Contemination 0.1]


[Contemination 0.01]

When running this machine learning model in VS Code, the most critical hyperparameter is Contamination.

  • Operating Principle: This numerical value dictates how strictly the AI judges whether data is normal or abnormal. Setting it to 0.1 (10%) rather than 0.01 (1%) forces the model to filter out much more data, resulting in significantly fewer data points being classified as "Normal."
  • False Positives & The Engineer's Role: If this value is set too high, the AI forcefully tries to filter out defects, causing "False Positives" where perfectly fine data is recognized as a fault. Finding the sweet spot—neither too sensitive nor too dull—is the practical "dilemma." Therefore, we cannot solely rely on AI results. It is essential for hardware engineers to manually inspect the graphs, make physical judgments (e.g., "Actually, this ripple is acceptable"), and determine the optimal Contamination level.

Result Visualization Analysis & Final Insights

The graph of the AI's predictions accurately visualizes the component's degradation over time.

  • Time-Series Interpretation: Moving right along the X-axis indicates the passage of time. As time passes, the capacitor's ESR increases, meaning the data shifts sequentially: Circle (Normal) -> Triangle (Warning) -> Cross (Fault).
  • Y-axis & Fault Identification: The Y-axis represents the Vo ripple value, which increases as it moves to the right. An excessively large ripple value directly indicates a fault.
  • The Power of AI Boundaries: The AI boundary (dotted line) drawn on the graph is a standard the AI established entirely on its own by analyzing only the patterns of the "Normal" data it was taught. Interestingly, there are some Cross (Fault) data points located below the dotted line, meaning their ripple amplitude is relatively small, yet they were still flagged as abnormal. This proves that the AI isolates anomalies not just by looking at the height of the ripple, but by recognizing that it "differs from the Normal data pattern." This demonstrates the formidable power of the Isolation Forest algorithm.

💡 Final Conclusion (Engineering View)

The greatest takeaway from this project isn't simply the experience of "writing some AI code." It is the acquisition of an 'Engineering View'—the ability to organically weave together circuit theory (physical domain knowledge) and machine learning (data analysis capabilities) to analyze and diagnose system issues from multiple, comprehensive angles.

Top comments (0)