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

/**
 * 数据原因分析结构
 * 对应C语言中的data_cause
 */
public class DataCause {
    public static final int MAX_DATA_LEN = 128 * 50 * 60;

    // 原始采样数据
    private float[] va = new float[MAX_DATA_LEN];
    private float[] vb = new float[MAX_DATA_LEN];
    private float[] vc = new float[MAX_DATA_LEN];
    private float[] t = new float[MAX_DATA_LEN];

    // 计算出的有效值
    private float[] rmsa = new float[MAX_DATA_LEN];
    private float[] rmsb = new float[MAX_DATA_LEN];
    private float[] rmsc = new float[MAX_DATA_LEN];
    private float[] rmsMin = new float[MAX_DATA_LEN];
    private float[] rmsMax = new float[MAX_DATA_LEN];

    // dq变换幅值
    private float[] ua = new float[MAX_DATA_LEN];
    private float[] ub = new float[MAX_DATA_LEN];
    private float[] uc = new float[MAX_DATA_LEN];

    private float[] ua0 = new float[MAX_DATA_LEN];
    private float[] ub0 = new float[MAX_DATA_LEN];
    private float[] uc0 = new float[MAX_DATA_LEN];

    // dq变换相位
    private float[] anga = new float[MAX_DATA_LEN];
    private float[] angb = new float[MAX_DATA_LEN];
    private float[] angc = new float[MAX_DATA_LEN];

    // dq变换相量
    private VecStruct[] phasora = new VecStruct[MAX_DATA_LEN];
    private VecStruct[] phasorb = new VecStruct[MAX_DATA_LEN];
    private VecStruct[] phasorc = new VecStruct[MAX_DATA_LEN];

    private int smp;      // 采样率
    private int num;      // 数据点数
    private float f;      // 频率
    private float un;     // 额定电压

    // Constructor
    public DataCause() {
        // 初始化相量数组
        for (int i = 0; i < MAX_DATA_LEN; i++) {
            phasora[i] = new VecStruct();
            phasorb[i] = new VecStruct();
            phasorc[i] = new VecStruct();
        }
    }

    // Getters and Setters
    public float[] getVa() { return va; }
    public void setVa(float[] va) { 
        System.arraycopy(va, 0, this.va, 0, Math.min(va.length, MAX_DATA_LEN)); 
    }

    public float[] getVb() { return vb; }
    public void setVb(float[] vb) { 
        System.arraycopy(vb, 0, this.vb, 0, Math.min(vb.length, MAX_DATA_LEN)); 
    }

    public float[] getVc() { return vc; }
    public void setVc(float[] vc) { 
        System.arraycopy(vc, 0, this.vc, 0, Math.min(vc.length, MAX_DATA_LEN)); 
    }

    public float[] getT() { return t; }
    public void setT(float[] t) { 
        System.arraycopy(t, 0, this.t, 0, Math.min(t.length, MAX_DATA_LEN)); 
    }

    public float[] getRmsa() { return rmsa; }
    public void setRmsa(float[] rmsa) { 
        System.arraycopy(rmsa, 0, this.rmsa, 0, Math.min(rmsa.length, MAX_DATA_LEN)); 
    }

    public float[] getRmsb() { return rmsb; }
    public void setRmsb(float[] rmsb) { 
        System.arraycopy(rmsb, 0, this.rmsb, 0, Math.min(rmsb.length, MAX_DATA_LEN)); 
    }

    public float[] getRmsc() { return rmsc; }
    public void setRmsc(float[] rmsc) { 
        System.arraycopy(rmsc, 0, this.rmsc, 0, Math.min(rmsc.length, MAX_DATA_LEN)); 
    }

    public float[] getRmsMin() { return rmsMin; }
    public void setRmsMin(float[] rmsMin) { 
        System.arraycopy(rmsMin, 0, this.rmsMin, 0, Math.min(rmsMin.length, MAX_DATA_LEN)); 
    }

    public float[] getRmsMax() { return rmsMax; }
    public void setRmsMax(float[] rmsMax) { 
        System.arraycopy(rmsMax, 0, this.rmsMax, 0, Math.min(rmsMax.length, MAX_DATA_LEN)); 
    }

    public float[] getUa() { return ua; }
    public void setUa(float[] ua) { 
        System.arraycopy(ua, 0, this.ua, 0, Math.min(ua.length, MAX_DATA_LEN)); 
    }

    public float[] getUb() { return ub; }
    public void setUb(float[] ub) { 
        System.arraycopy(ub, 0, this.ub, 0, Math.min(ub.length, MAX_DATA_LEN)); 
    }

    public float[] getUc() { return uc; }
    public void setUc(float[] uc) { 
        System.arraycopy(uc, 0, this.uc, 0, Math.min(uc.length, MAX_DATA_LEN)); 
    }

    public float[] getUa0() { return ua0; }
    public void setUa0(float[] ua0) { 
        System.arraycopy(ua0, 0, this.ua0, 0, Math.min(ua0.length, MAX_DATA_LEN)); 
    }

    public float[] getUb0() { return ub0; }
    public void setUb0(float[] ub0) { 
        System.arraycopy(ub0, 0, this.ub0, 0, Math.min(ub0.length, MAX_DATA_LEN)); 
    }

    public float[] getUc0() { return uc0; }
    public void setUc0(float[] uc0) { 
        System.arraycopy(uc0, 0, this.uc0, 0, Math.min(uc0.length, MAX_DATA_LEN)); 
    }

    public float[] getAnga() { return anga; }
    public void setAnga(float[] anga) { 
        System.arraycopy(anga, 0, this.anga, 0, Math.min(anga.length, MAX_DATA_LEN)); 
    }

    public float[] getAngb() { return angb; }
    public void setAngb(float[] angb) { 
        System.arraycopy(angb, 0, this.angb, 0, Math.min(angb.length, MAX_DATA_LEN)); 
    }

    public float[] getAngc() { return angc; }
    public void setAngc(float[] angc) { 
        System.arraycopy(angc, 0, this.angc, 0, Math.min(angc.length, MAX_DATA_LEN)); 
    }

    public VecStruct[] getPhasora() { return phasora; }
    public VecStruct[] getPhasorb() { return phasorb; }
    public VecStruct[] getPhasorc() { return phasorc; }

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

    public int getNum() { return num; }
    public void setNum(int num) { this.num = num; }

    public float getF() { return f; }
    public void setF(float f) { this.f = f; }

    public float getUn() { return un; }
    public void setUn(float un) { this.un = un; }
}