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

//风电光伏配置
public class PowerSet
{
	public float rated_p; //额定功率
	public float rated_i; //额定电流
	public float mk_p; //启停机功率
	public float mk_i; //启停机电流
	public float set_p; //功率调节功率目标量
	public float set_p_mk; //功率调节量目标门槛
	public float set_q; //无功功率调节功率目标量
	public float set_q_mk; //无功功率调节量目标门槛
	public float set_q_xz; //无功功率调节限值
	//以上参数为一次值，功率单位MW,电流单位A
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public uint reg_ok_num;
	public int reg_ok_num; //功率区间所需个数
	//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public uint run_time;
	public int run_time; //测试超时时间，以分钟为单位
	public char[] by = new char[1024]; //1024个字节，留着后期扩展备用

	//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public uint uStatus;
	public int uStatus;
	//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public uint Check_sum;
	public int Check_sum;
	public static int GetSize()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		int len = 9 *  Float.SIZE / Byte.SIZE+ 4 * Integer.SIZE / Byte.SIZE + 1024;
		return len;
	}
	public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
	{
		int nSize = bArray.length;
		int nStep = nHaveRead; //读取数据的步长

		if (nSize < (GetSize() + nHaveRead))
		{
			return false;
		}
		rated_p = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		rated_i = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		mk_p = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		mk_i = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		set_p = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		set_p_mk = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		set_q = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		set_q_mk = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		set_q_xz = Service.convertfloat(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep +=  Float.SIZE / Byte.SIZE;
		reg_ok_num = Service.convertUInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep += Integer.SIZE / Byte.SIZE;
		run_time = Service.convertUInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep += Integer.SIZE / Byte.SIZE;
		for (int i = 0; i < by.length; i++)
		{
			by[i] = (char)bArray[nStep];
			nStep++;
		}
		uStatus = Service.convertUInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep += Integer.SIZE / Byte.SIZE;
		Check_sum = Service.convertUInt32_net(bArray, nStep);
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
		nStep += Integer.SIZE / Byte.SIZE;

		return true;
	}

	public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
	{
		int nSize = bArray.argvalue.length;
		if (nSize < (nHaveRead + GetSize()))
		{
			return 0;
		}
		int iStep = nHaveRead;

		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)rated_p, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)rated_i, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)mk_p, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)mk_i, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_p, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_p_mk, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_q, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_q_mk, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_q_xz, Service.enum_Value_type.Value_float);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)reg_ok_num, Service.enum_Value_type.Value_uint);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)run_time, Service.enum_Value_type.Value_uint);

		for (int i = 0; i < by.length; i++)
		{
			bArray.argvalue[iStep] = (byte)by[i];
			iStep++;
		}
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)uStatus, Service.enum_Value_type.Value_uint);
		iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)Check_sum, Service.enum_Value_type.Value_uint);
		return GetSize();
	}
}