This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28P550SJ: what's means about result.buf0[0]&result.buf0[1] in AFCI demo code

Part Number: TMS320F28P550SJ

For the provided AFCI demo program ml_arc_detction_F28P55X, in the arc_detection.c file, what do the two variables result.buf0[0] and result.buf0[1] represent?
 
image.png
  • Hi Alfred,

    Thanks for reaching out here.

    Breaking down what `result.buf0[0]` and `result.buf0[1]` represent within the context of the AFCI demo code (specifically `ml_arc_detction_F28P55X` and `arc_detection.c`).

    Understanding the Context: AFCI and Thresholds

    The AFCI (Arc Fault Circuit Interrupter) demo uses a machine learning algorithm (specifically an Arc Detection algorithm) to identify arc faults in an electrical circuit. The algorithm analyzes the voltage and current waveforms to distinguish normal operation from the characteristic "signature" of an arc fault.

    The core of the AFCI detection relies on comparing calculated features against thresholds. These thresholds define the boundaries between normal operation and arc fault conditions.

    What `result.buf0[0]` and `result.buf0[1]` are:

    • result.buf0[0]`: This variable holds the *input feature* generated by the Arc Detection algorithm. Typically, this is the value representing the arc fault characteristic from the latest sample. It's some kind of calculated metric from the voltage/current data.
    • result.buf0[1]`: This variable holds a *threshold value*. This is a pre-defined upper limit for the input feature. If `result.buf0[0]` exceeds this threshold, it indicates a possible arc fault.

    The Comparison and Logic

    The code `if (result.buf0[0] <= result.buf0[1])` is critical.

    • result.buf0[0] <= result.buf0[1]` (Arc Detected): If the calculated feature value (`result.buf0[0]`) is *less than or equal to* the threshold (`result.buf0[1]`), the code considers an arc fault *detected*. This appears counterintuitive at first glance.
    • Important: In this specific implementation, a lower feature value indicates higher likelihood of arc fault. The algorithm likely extracts a feature that *decreases* in value when an arc is present.
    • `else` (No Arc):** If the calculated feature value (`result.buf0[0]`) is *greater than* the threshold (`result.buf0[1]`), the code concludes that no arc is present at that time.

    Further Explanation:

    The `result.buf0[0]` and `result.buf0[1]` variables, along with the conditional statement, form a basic thresholding mechanism for detecting arc faults. The algorithm works by monitoring input features and comparing them to a fixed threshold. When a feature value falls below the threshold, it indicates that an arc fault has occurred.

    In summary, the code is using a thresholding approach to detect arc faults based on a calculated feature (`result.buf0[0]`) and a predefined threshold (`result.buf0[1]`). Because of its implementation, a lower feature value indicates a higher likelihood of a fault.

    Best Regards,

    Zackary Fleenor