package com.njcn.csharmonic.offline.mincfg.vo;

/**
 @brief 3秒、分钟统计数据、日统计单个类型结构

 */
public class tagPqData_Float
{
	public short name; ///监测点号 12 /// </summary>
	public short Data_Type; ///数据类型 2 /// </summary>
	public RTC_Timer time; ///时间 /// </summary>
	public float[] Rms; ///电压A B C N 电流A B C N 线电压AB BC CA/// </summary>
	public float[] UU_Deviation; ///电压上偏差(3线电压)24 /// </summary>
	public float[] UL_Deviation; ///电压下偏差/// </summary>
	public float[] F_Deviation; ///频率偏差 8 /// </summary>
	public float[][] UI_Seq; ///电压电流零、正、负序、不平衡度32 第一个[]电压，电流；第二个[]零、正、负序、不平衡度/// </summary>
	public float[][] FuHarm; ///整次谐波 电压A B C N 电流A B C N 1200 /// </summary>
	public float[][] FuHarmPhase; ///谐波相角-送一半数据 600 /// </summary>
	public tagInHarmData_float[][] InHarm; ///间谐波-送一半数据 1200 /// </summary>
	public float[][] Total_Power; ///a,b,c,total 总功率(P.Q.S) 48 /// </summary>
	public tagPowerData_float[][] Harm_Power; ///谐波功率-送一半数据 1200 /// </summary>
	public float[][] Harm_Contain; ///谐波含有率 xxx.xx 600 /// </summary>
	public float[] Harm_Aberrance; ///谐波畸变率 xxx.xx 12 /// </summary>
	public float[] Cos_PF; ///视在功率因数 =P/S xx.xxx 8 /// </summary>
	public float[] Cos_DF; ///位移功率因数=P/S1 xx.xxx 8 /// </summary>
	public float[] U_Fluctuation; ///电压波动 xx.xxx 6 /// </summary>
	public float[] U_Flicker; ///电压闪变 xx.xxx 6 /// </summary>
	public float[] UL_Flicker; ///电压长闪变 xx.xxx 6 /// </summary>

	public int EventFlag = 0; //暂态发生标志 1表示期间发生暂态 0表示暂未发生暂态
	public int DataFlag = 0; //数据去除标志 1表示去除 0表示保留
	public tagPqData_Float()
	{
		int i = 0, j = 0;

		time = new RTC_Timer();
		Rms = new float[9];
		UU_Deviation = new float[6];
		UL_Deviation = new float[6];
		F_Deviation = new float[2];
		UI_Seq = new float[2][4];
		FuHarm = new float[6][50];
		FuHarmPhase = new float[6][50];
		InHarm = new tagInHarmData_float[6][50];
		for (i = 0; i < 6; i++)
		{
			for (j = 0; j < 50; j++)
			{
				InHarm[i][j] = new tagInHarmData_float();
			}
		}
		Total_Power = new float[4][3];
		Harm_Power = new tagPowerData_float[4][50];
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 50; j++)
			{
				Harm_Power[i][j] = new tagPowerData_float();
			}
		}
		Harm_Contain = new float[6][50];
		Harm_Aberrance = new float[8];
		Cos_PF = new float[4];
		Cos_DF = new float[4];
		U_Fluctuation = new float[3];
		U_Flicker = new float[3];
		UL_Flicker = new float[3];
	}

	public final void SetFloatValue(tagPqData SrcData, float fPT, float fCT)
	{
		name = SrcData.name;
		Data_Type = SrcData.Data_Type;
		time.clone(SrcData.time);
		int i = 0, j = 0;
		for (i = 0; i < 2; i++)
		{
			F_Deviation[i] = Service.IntToFloat(SrcData.F_Deviation[i]);
			for (j = 0; j < 4; j++)
			{
				if (i == 0)
				{
					if (j == 2) //正序
					{
						UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]) * fPT; // / 1000 2019/9/9 修改 正序的值小了1000倍
					}
					else if (j < 3)
					{
						UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]) * fPT * 1000;
					}
					else
					{
						UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]);
					}
				}
				else
				{
					if (j < 3)
					{
						UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]) * fCT;
					}
					else
					{
						UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]);
					}
				}
			}
		}
		for (i = 0; i < 3; i++)
		{
			U_Fluctuation[i] = Service.ShorToFloat1000(SrcData.U_Fluctuation[i]);
			U_Flicker[i] = Service.ShorToFloat1000(SrcData.U_Flicker[i]);
			UL_Flicker[i] = Service.ShorToFloat1000(SrcData.UL_Flicker[i]);
		}
		for (i = 0; i < 4; i++)
		{
			Cos_PF[i] = Service.ShorToFloat10000(SrcData.Cos_PF[i]);
			Cos_DF[i] = Service.ShorToFloat10000(SrcData.Cos_DF[i]);
			for (j = 0; j < 3; j++)
			{
				Total_Power[i][j] = Service.IntToFloat(SrcData.Total_Power[i][j]) * fPT * fCT;
			}
			for (j = 0; j < 50; j++)
			{
				Harm_Power[i][j].P = Service.IntToFloat(SrcData.Harm_Power[i][j].P) * fPT * fCT;
				Harm_Power[i][j].Q = Service.IntToFloat(SrcData.Harm_Power[i][j].Q) * fPT * fCT;
				Harm_Power[i][j].S = Service.IntToFloat(SrcData.Harm_Power[i][j].S) * fPT * fCT;
			}

		}
		for (i = 0; i < 6; i++)
		{
			UU_Deviation[i] = Service.IntToFloat(SrcData.UU_Deviation[i]);
			UL_Deviation[i] = Service.IntToFloat(SrcData.UL_Deviation[i]);
			Harm_Aberrance[i] = Service.ShorToFloat100(SrcData.Harm_Aberrance[i]);
			for (j = 0; j < 50; j++)
			{
				if (i < 3)
				{
					FuHarm[i][j] = Service.IntToFloat(SrcData.FuHarm[i][j]) * fPT;
				}
				else
				{
					FuHarm[i][j] = Service.IntToFloat(SrcData.FuHarm[i][j]) * fCT;
				}
				FuHarmPhase[i][j] = Service.IntToFloat(SrcData.FuHarmPhase[i][j]);
				InHarm[i][j].Val = Service.IntToFloat(SrcData.InHarm[i][j].Val);
				Harm_Contain[i][j] = Service.ShorToFloat100(SrcData.Harm_Contain[i][j]);
			}
		}
		for (i = 0; i < 9; i++)
		{
			if (i > 2 && i < 6)
			{
				Rms[i] = Service.IntToFloat(SrcData.Rms[i]) * fCT;
			}
			else
			{
				Rms[i] = Service.IntToFloat(SrcData.Rms[i]) * fPT;
			}
		}

	}
}