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

/**
 * 数据特征结构
 * 对应C语言中的data_feature
 */
public class DataFeature {
    // 暂降原因定义
    public static final int CAUSE_TYPE0 = 0;   // 未知
    public static final int CAUSE_TYPE1 = 1;   // 短路故障
    public static final int CAUSE_TYPE2 = 2;   // 电压调节器
    public static final int CAUSE_TYPE3 = 3;   // 感动电机
    public static final int CAUSE_TYPE4 = 4;   // 电压跌落


    // 暂降类型定义
    public static final int TYPE0 = 0;   // BC相间故障
    public static final int TYPE1 = 1;   // C相接地故障
    public static final int TYPE2 = 2;   // AC相间故障
    public static final int TYPE3 = 3;   // A相接地故障
    public static final int TYPE4 = 4;   // AB相间故障
    public static final int TYPE5 = 5;   // B相接地故障
    public static final int TYPE6 = 6;   // BC相间接地
    public static final int TYPE7 = 7;   // AC相间接地
    public static final int TYPE8 = 8;   // AB相间接地
    public static final int TYPE9 = 9;   // 三相故障
    public static final int TYPE10 = 10;   // 未知


    private int TS;                        // 暂降开始时刻
    private int TE;                        // 暂降结束时刻
    private int smp;                       // 采样率
    private float UN;                      // 系统额定电压

    // 特征参数
    private int preBphErr;                 // 稳态前电气平衡异常标志
    private int preHarmErr;                // 稳态前偶次谐波异常标志
    private int uLow50;                    // 稳态事件期间三相中低于50%额值持续一个周波以上
    private int uHigh120;                  // 稳态事件期间三相中高于120%额值持续一个周波以上
    private int holdTime;                  // 持续时间（按照周波计算）
    private float u3Max;                   // 暂降期电压有效值最大值
    private float u3Min;                   // 最小值（标幺）
    private float[] uMin = new float[3];   // 三相最小值
    private float gao;                     // 高斯性
    private float bi1;                     // 椭圆特征bi1
    private float bi2;                     // 椭圆特征bi2
    private float biaozhun;                // 统计特征-标准差
    private float pian;                    // 统计特征-偏度
    private float qiao;                    // 统计特征-峭度

    private float u2Max;                   // 负序电压最大值（相对un百分比）
    private float u2Avg;                   // 负序电压平均值（相对un百分比）
    private float u0Max;                   // 零序电压最大值（相对un百分比）
    private float u0Avg;                   // 零序电压平均值（相对un百分比）
    private float bphMax;                  // 不平衡度%
    private float bphAvg;                  // 不平衡度%

    private float[] harm2Max = new float[3];    // 2次谐波三相的最大值  相对un
    private float[] harm4Max = new float[3];    // 4次谐波三相的最大值  相对un
    private float[] harm2Avg = new float[3];    // 2次谐波三相平均值  相对un
    private float[] harm4Avg = new float[3];    // 4次谐波三相平均值  相对un

    private float svd;                     // 奇异值

    // 结果
    private int cause;                     // 电压暂降分类暂降原因

    // Constructors
    public DataFeature() {
        this.cause = CAUSE_TYPE0;
    }

    // Getters and Setters
    public int getTS() { return TS; }
    public void setTS(int TS) { this.TS = TS; }

    public int getTE() { return TE; }
    public void setTE(int TE) { this.TE = TE; }

    public int getSmp() { return smp; }
    public void setSmp(int smp) { this.smp = smp; }

    public float getUN() { return UN; }
    public void setUN(float UN) { this.UN = UN; }

    public int getPreBphErr() { return preBphErr; }
    public void setPreBphErr(int preBphErr) { this.preBphErr = preBphErr; }

    public int getPreHarmErr() { return preHarmErr; }
    public void setPreHarmErr(int preHarmErr) { this.preHarmErr = preHarmErr; }

    public int getuLow50() { return uLow50; }
    public void setuLow50(int uLow50) { this.uLow50 = uLow50; }

    public int getuHigh120() { return uHigh120; }
    public void setuHigh120(int uHigh120) { this.uHigh120 = uHigh120; }

    public int getHoldTime() { return holdTime; }
    public void setHoldTime(int holdTime) { this.holdTime = holdTime; }

    public float getU3Max() { return u3Max; }
    public void setU3Max(float u3Max) { this.u3Max = u3Max; }

    public float getU3Min() { return u3Min; }
    public void setU3Min(float u3Min) { this.u3Min = u3Min; }

    public float[] getUMin() { return uMin; }
    public void setUMin(float[] uMin) { System.arraycopy(uMin, 0, this.uMin, 0, Math.min(uMin.length, 3)); }

    public float getGao() { return gao; }
    public void setGao(float gao) { this.gao = gao; }

    public float getBi1() { return bi1; }
    public void setBi1(float bi1) { this.bi1 = bi1; }

    public float getBi2() { return bi2; }
    public void setBi2(float bi2) { this.bi2 = bi2; }

    public float getBiaozhun() { return biaozhun; }
    public void setBiaozhun(float biaozhun) { this.biaozhun = biaozhun; }

    public float getPian() { return pian; }
    public void setPian(float pian) { this.pian = pian; }

    public float getQiao() { return qiao; }
    public void setQiao(float qiao) { this.qiao = qiao; }

    public float getU2Max() { return u2Max; }
    public void setU2Max(float u2Max) { this.u2Max = u2Max; }

    public float getU2Avg() { return u2Avg; }
    public void setU2Avg(float u2Avg) { this.u2Avg = u2Avg; }

    public float getU0Max() { return u0Max; }
    public void setU0Max(float u0Max) { this.u0Max = u0Max; }

    public float getU0Avg() { return u0Avg; }
    public void setU0Avg(float u0Avg) { this.u0Avg = u0Avg; }

    public float getBphMax() { return bphMax; }
    public void setBphMax(float bphMax) { this.bphMax = bphMax; }

    public float getBphAvg() { return bphAvg; }
    public void setBphAvg(float bphAvg) { this.bphAvg = bphAvg; }

    public float[] getHarm2Max() { return harm2Max; }
    public void setHarm2Max(float[] harm2Max) { System.arraycopy(harm2Max, 0, this.harm2Max, 0, Math.min(harm2Max.length, 3)); }

    public float[] getHarm4Max() { return harm4Max; }
    public void setHarm4Max(float[] harm4Max) { System.arraycopy(harm4Max, 0, this.harm4Max, 0, Math.min(harm4Max.length, 3)); }

    public float[] getHarm2Avg() { return harm2Avg; }
    public void setHarm2Avg(float[] harm2Avg) { System.arraycopy(harm2Avg, 0, this.harm2Avg, 0, Math.min(harm2Avg.length, 3)); }

    public float[] getHarm4Avg() { return harm4Avg; }
    public void setHarm4Avg(float[] harm4Avg) { System.arraycopy(harm4Avg, 0, this.harm4Avg, 0, Math.min(harm4Avg.length, 3)); }

    public float getSvd() { return svd; }
    public void setSvd(float svd) { this.svd = svd; }

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