package com.njcn.influx.event.cause.model;

/**
 * 电压暂降数据结构
 * 对应C语言中的qvvr_data_struct
 */
public class QvvrDataStruct {
    public static final int MAX_SMP_DATA_LEN = 128 * 50 * 120;
    
    // 输入参数定义
    private float[] smpVa = new float[MAX_SMP_DATA_LEN];  // A相电压采样数据
    private float[] smpVb = new float[MAX_SMP_DATA_LEN];  // B相电压采样数据
    private float[] smpVc = new float[MAX_SMP_DATA_LEN];  // C相电压采样数据
    private int smpRate;                                  // 采样率参数
    private int smpLen;                                   // 每个通道的采样数据个数
    
    // 输入阈值参数
    private float[] threshold = new float[50];            // 预设阈值时间参数
    
    // 输出结果参数定义
    private int cause;        // 电压暂降判断出暂降原因 0-未知,1-短路,2-电压调节器,3-感动电机
    private int noCal;        // 未计算判断标志，该位1表示输入数据有问题

    // Constructors
    public QvvrDataStruct() {
        this.cause = 0;
        this.noCal = 0;
    }

    // Getters and Setters
    public float[] getSmpVa() {
        return smpVa;
    }

    public void setSmpVa(float[] smpVa) {
        if (smpVa.length <= MAX_SMP_DATA_LEN) {
            System.arraycopy(smpVa, 0, this.smpVa, 0, smpVa.length);
        }
    }

    public float[] getSmpVb() {
        return smpVb;
    }

    public void setSmpVb(float[] smpVb) {
        if (smpVb.length <= MAX_SMP_DATA_LEN) {
            System.arraycopy(smpVb, 0, this.smpVb, 0, smpVb.length);
        }
    }

    public float[] getSmpVc() {
        return smpVc;
    }

    public void setSmpVc(float[] smpVc) {
        if (smpVc.length <= MAX_SMP_DATA_LEN) {
            System.arraycopy(smpVc, 0, this.smpVc, 0, smpVc.length);
        }
    }

    public int getSmpRate() {
        return smpRate;
    }

    public void setSmpRate(int smpRate) {
        this.smpRate = smpRate;
    }

    public int getSmpLen() {
        return smpLen;
    }

    public void setSmpLen(int smpLen) {
        this.smpLen = smpLen;
    }

    public float[] getThreshold() {
        return threshold;
    }

    public void setThreshold(float[] threshold) {
        if (threshold.length <= 50) {
            System.arraycopy(threshold, 0, this.threshold, 0, threshold.length);
        }
    }

    public int getCause() {
        return cause;
    }

    public void setCause(int cause) {
        this.cause = cause;
    }

    public int getNoCal() {
        return noCal;
    }

    public void setNoCal(int noCal) {
        this.noCal = noCal;
    }
}