using GDNXFD.Data.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDNXFD.WcfService
{
public class HelpperMethod
{
///
/// 获取风机状态
///
/// 风机状态值
/// 风机状态(枚举)
public static WStatus GetWindturbineStatus(double statusValue)
{
WStatus status = WStatus.UnKnow;
int st = Convert.ToInt32(statusValue);
switch (st)
{
//0-停机-TJTS、 1-上电-SDTS、2-待机-DJTS、3-启动-QDTS、4-并网-BWTS、5-故障-GZTS、6-维护-WHTS、 7-离线-LXTS
case 0: //停机状态
status = WStatus.Stop;
break;
case 1: //上电状态
status = WStatus.OnPower;
break;
case 2: //待机状态
status = WStatus.Standby;
break;
case 3: //启动状态
status = WStatus.Start;
break;
case 4: //并网状态
status = WStatus.Online;
break;
case 5: //故障状态
status = WStatus.Fault;
break;
case 6: //维护状态
status = WStatus.Maintain;
break;
case 7: //离线状态
status = WStatus.Offline;
break;
default:
status = WStatus.UnKnow;
break;
}
return status;
}
public static HungType GetHungType(double lockValue) {
HungType hung = HungType.UnKnow;
int st = Convert.ToInt32(lockValue);
switch (st)
{
case 0: //未挂牌
hung = HungType.UnLock;
break;
case 2: //场内受累检修
hung = HungType.StationCheckLock;
break;
case 3: //场内受累故障
hung = HungType.StationFaulLock;
break;
case 4: //场外受累电网
hung = HungType.StationPowerLineLock;
break;
case 5: //场外受累天气
hung = HungType.StationWeatherLock;
break;
case 7: //故障检修
hung = HungType.FaultLock;
break;
case 8: //检修
hung = HungType.CheckLock;
break;
default:
hung = HungType.UnKnow;
break;
}
return hung;
}
public static string GetWindDirection(double value)
{
if (value >= 11.25 && value < 33.75)
return "NNE";
else if (value >= 33.75 && value < 56.25)
return "NE";
else if (value >= 56.25 && value < 78.75)
return "ENE";
else if (value >= 78.75 && value < 101.25)
return "E";
else if (value >= 101.25 && value < 123.75)
return "ESE";
else if (value >= 123.75 && value < 146.25)
return "SE";
else if (value >= 146.25 && value < 168.75)
return "SSE";
else if (value >= 168.75 && value < 191.25)
return "S";
else if (value >= 191.25 && value < 213.75)
return "SSW";
else if (value >= 213.75 && value < 236.25)
return "SW";
else if (value >= 236.25 && value < 258.75)
return "WSW";
else if (value >= 258.75 && value < 281.25)
return "W";
else if (value >= 281.25 && value < 303.75)
return "WNW";
else if (value >= 303.75 && value < 326.25)
return "NW";
else if (value >= 326.25 && value < 348.75)
return "NNW";
else if (value >= 348.75 || value < 11.25)
return "N";
return "UNKNOW";
}
}
}