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

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
///#endregion

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

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

	public tagPqData()
	{
		int i = 0, j = 0;

		time = new RTC_Timer();
		Rms = new Integer[9];
		UU_Deviation = new Integer[6];
		UL_Deviation = new Integer[6];
		F_Deviation = new Integer[2];
		UI_Seq = new Integer[2][4];
		FuHarm = new Integer[6][50];
		FuHarmPhase = new Integer[6][50];
		InHarm = new tagInHarmData[6][50];
		for (i = 0; i < 6; i++)
		{
			for (j = 0; j < 50; j++)
			{
				InHarm[i][j] = new tagInHarmData();
			}
		}
		Total_Power = new Integer[4][3];
		Harm_Power = new tagPowerData[4][50];
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 50; j++)
			{
				Harm_Power[i][j] = new tagPowerData();
			}
		}
		Harm_Contain = new Short[6][50];
		Harm_Aberrance = new Short[6];
		Cos_PF = new Short[4];
		Cos_DF = new Short[4];
		U_Fluctuation = new Short[3];
		U_Flicker = new Short[3];
		UL_Flicker = new Short[3];
	}
	/**
	 @brief 读取类的长度
	 @return int out 类的长度

	 */
	public static int GetSize()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		int nLen = RTC_Timer.GetSize() + (9 + 6 + 6 + 2 + 8 + 300 + 300 + 12) * Integer.SIZE / Byte.SIZE + 300 * tagInHarmData.GetSize() + 200 * tagPowerData.GetSize() + (300 + 6 + 4 + 4 + 3 + 3 + 3 + 2) * Short.SIZE / Byte.SIZE;

		return nLen + 2; //2字节补齐
	}
	/**
	 @brief 将通讯或者文件读取的二进制流写入到类中
	 @return int out 类的长度

	 */
	public final boolean GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
	{
		int nSize = bArray.argvalue.length;
		int nStep = nHaveRead; //读取数据的步长

		if (nSize < (GetSize() + nHaveRead))
		{
			return false;
		}
		nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Short)name, Service.enum_Value_type.Value_short);

		nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Short)Data_Type, Service.enum_Value_type.Value_short);

		time.GetStructBuf(bArray, nStep);
		nStep += RTC_Timer.GetSize();

		nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Integer)Rms[0], Service.enum_Value_type.Value_int);
		nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Integer)Rms[1], Service.enum_Value_type.Value_int);
		nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Integer)Rms[2], Service.enum_Value_type.Value_int);

		return true;
	}
	/**
	 @brief 将通讯或者文件读取的二进制流写入到类中
	 @return int out 类的长度

	 */
	public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
	{
		int i = 0, j = 0;
		int nSize = bArray.length;
		int nStep = nHaveRead; //读取数据的步长

		if (nSize < (GetSize() + nHaveRead))
		{
			return false;
		}
		name = Service.convertInt16_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep += Short.SIZE / Byte.SIZE;

		Data_Type = Service.convertInt16_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep += Short.SIZE / Byte.SIZE;

		time.SetStructBuf(bArray, nStep);
		nStep += RTC_Timer.GetSize();

		RefObject<Integer[]> tempRef_Rms = new RefObject<Integer[]>(Rms);
		nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_Rms);
		Rms = tempRef_Rms.argvalue;
		RefObject<Integer[]> tempRef_UU_Deviation = new RefObject<Integer[]>(UU_Deviation);
		nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_UU_Deviation);
		UU_Deviation = tempRef_UU_Deviation.argvalue;
		RefObject<Integer[]> tempRef_UL_Deviation = new RefObject<Integer[]>(UL_Deviation);
		nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_UL_Deviation);
		UL_Deviation = tempRef_UL_Deviation.argvalue;
		RefObject<Integer[]> tempRef_F_Deviation = new RefObject<Integer[]>(F_Deviation);
		nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_F_Deviation);
		F_Deviation = tempRef_F_Deviation.argvalue;
		RefObject<Integer[][]> tempRef_UI_Seq = new RefObject<Integer[][]>(UI_Seq);
		nStep += Service.convertInt32Array(bArray, nStep, tempRef_UI_Seq);
		UI_Seq = tempRef_UI_Seq.argvalue;
		RefObject<Integer[][]> tempRef_FuHarm = new RefObject<Integer[][]>(FuHarm);
		nStep += Service.convertInt32Array(bArray, nStep, tempRef_FuHarm);
		FuHarm = tempRef_FuHarm.argvalue;
		RefObject<Integer[][]> tempRef_FuHarmPhase = new RefObject<Integer[][]>(FuHarmPhase);
		nStep += Service.convertInt32Array(bArray, nStep, tempRef_FuHarmPhase);
		FuHarmPhase = tempRef_FuHarmPhase.argvalue;

		for (i = 0; i < 6; i++)
		{
			for (j = 0; j < 50; j++)
			{
				InHarm[i][j].Val = Service.convertInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
				nStep += Integer.SIZE / Byte.SIZE;
				InHarm[i][j].f = Service.convertInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
				nStep += Integer.SIZE / Byte.SIZE;
			}
		}
		RefObject<Integer[][]> tempRef_Total_Power = new RefObject<Integer[][]>(Total_Power);
		nStep += Service.convertInt32Array(bArray, nStep, tempRef_Total_Power);
		Total_Power = tempRef_Total_Power.argvalue;
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 50; j++)
			{
				Harm_Power[i][j].P = Service.convertInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
				nStep += Integer.SIZE / Byte.SIZE;
				Harm_Power[i][j].Q = Service.convertInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
				nStep += Integer.SIZE / Byte.SIZE;
				Harm_Power[i][j].S = Service.convertInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
				nStep += Integer.SIZE / Byte.SIZE;
			}
		}
		RefObject<Short[][]> tempRef_Harm_Contain = new RefObject<Short[][]>(Harm_Contain);
		nStep += Service.convertInt16Array(bArray, nStep, tempRef_Harm_Contain);
		Harm_Contain = tempRef_Harm_Contain.argvalue;
		RefObject<Short[]> tempRef_Harm_Aberrance = new RefObject<Short[]>(Harm_Aberrance);
		nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_Harm_Aberrance);
		Harm_Aberrance = tempRef_Harm_Aberrance.argvalue;
		RefObject<Short[]> tempRef_Cos_PF = new RefObject<Short[]>(Cos_PF);
		nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_Cos_PF);
		Cos_PF = tempRef_Cos_PF.argvalue;
		RefObject<Short[]> tempRef_Cos_DF = new RefObject<Short[]>(Cos_DF);
		nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_Cos_DF);
		Cos_DF = tempRef_Cos_DF.argvalue;
		RefObject<Short[]> tempRef_U_Fluctuation = new RefObject<Short[]>(U_Fluctuation);
		nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_U_Fluctuation);
		U_Fluctuation = tempRef_U_Fluctuation.argvalue;
		RefObject<Short[]> tempRef_U_Flicker = new RefObject<Short[]>(U_Flicker);
		nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_U_Flicker);
		U_Flicker = tempRef_U_Flicker.argvalue;
		RefObject<Short[]> tempRef_UL_Flicker = new RefObject<Short[]>(UL_Flicker);
		nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_UL_Flicker);
		UL_Flicker = tempRef_UL_Flicker.argvalue;

		return true;
	}
}