|
@@ -0,0 +1,964 @@
|
|
|
+//package com.gyee.generation;
|
|
|
+//
|
|
|
+//import com.gyee.generation.util.realtimesource.IEdosUtil;
|
|
|
+//import org.springframework.beans.factory.annotation.Value;
|
|
|
+//
|
|
|
+//import javax.annotation.Resource;
|
|
|
+//import java.io.Console;
|
|
|
+//import java.util.Date;
|
|
|
+//
|
|
|
+//public class PowerCurveFittingService {
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// private IEdosUtil edosUtil;
|
|
|
+//
|
|
|
+// @Value("${curvefitting.dimension}")
|
|
|
+// private Integer dimension;
|
|
|
+// @Value("${curvefitting.scale}")
|
|
|
+// private Double scale;
|
|
|
+//
|
|
|
+//
|
|
|
+// public void CureFitting(Date nowDate, Date begion, int insertType, String fdcId, params String[] fdjIds)
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// Date current = nowDate.Date.AddDays(-1);
|
|
|
+// int year = current.Year;
|
|
|
+// int month = current.Month;
|
|
|
+// Date begin1 = new Date(year, month, 1);
|
|
|
+// Date begin2 = current.AddDays(-6);
|
|
|
+// //Date begin2 = current;
|
|
|
+// Date end = nowDate.Date;
|
|
|
+// if (begion != Date.MaxValue && begion != Date.MinValue)
|
|
|
+// {
|
|
|
+// begin1 = begion;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// int dimension = ConfigurationFramework.ConfigManager.MySection.CurveFitting.dimension;
|
|
|
+// double scale = ConfigurationFramework.ConfigManager.MySection.CurveFitting.scale;
|
|
|
+//
|
|
|
+// //上个月
|
|
|
+// int year2 = begin1.AddMonths(-1).Year;
|
|
|
+// int month2 = begin1.AddMonths(-1).Month;
|
|
|
+//
|
|
|
+// //去年同期
|
|
|
+// int year3 = begin1.AddYears(-1).Year;
|
|
|
+// int month3 = begin1.AddYears(-1).Month;
|
|
|
+//
|
|
|
+//
|
|
|
+// Dictionary<String, CureFitting> windDictionary = new Dictionary<String, CureFitting>();
|
|
|
+// using (GdsjEntities entities = new GdsjEntities())
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// var WindturbineIds = entities.WINDTURBINE.Where(GetConditionExpression<WINDTURBINE>(WindList.ToArray<String>(), "WINDPOWERSTATIONID")).ToList();
|
|
|
+//
|
|
|
+// if (windturbineCapacity == null)
|
|
|
+// {
|
|
|
+// windturbineCapacity = new Dictionary<String, decimal>();
|
|
|
+// Dictionary<String, EQUIPMENTMODEL> modelDictionary = entities.EQUIPMENTMODEL.ToDictionary(it => it.ID);
|
|
|
+// foreach (var windturbine in WindturbineIds)
|
|
|
+// {
|
|
|
+// if (modelDictionary.ContainsKey(windturbine.MODELID))
|
|
|
+// {
|
|
|
+// windturbineCapacity.Add(windturbine.ID, modelDictionary[windturbine.MODELID].POWERPRODUCTION.Value);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// foreach (var windturbine in WindturbineIds)
|
|
|
+// {
|
|
|
+// String windturbineId = windturbine.ID;
|
|
|
+// String windpowerId = windturbine.WINDPOWERSTATIONID;
|
|
|
+//
|
|
|
+// if (fdcId != null && fdcId != String.Empty)
|
|
|
+// {
|
|
|
+// if (fdcId != windpowerId)
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (fdjIds != null)
|
|
|
+// {
|
|
|
+// if (!fdjIds.Contains(windturbineId))
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// String pointIdGL = entities.WINDTURBINETESTINGPOINTAI.Where(it => it.UNIFORMCODE == BusinessHandle.GdnxfdTarget.FJYG && it.WINDTURBINEID == windturbineId).Select(it => it.ID).FirstOrDefault();
|
|
|
+//
|
|
|
+// String pointIdZT = entities.WINDTURBINETESTINGPOINTAI.Where(it => it.UNIFORMCODE == BusinessHandle.GdnxfdTarget.ZTMX && it.WINDTURBINEID == windturbineId).Select(it => it.ID).FirstOrDefault();
|
|
|
+//
|
|
|
+// String pointIdFS = "";
|
|
|
+// if (type == "GDC")
|
|
|
+// pointIdFS = entities.WINDPOWERSTATIONTESTINGPOINT.Where(it => it.UNIFORMCODE == BusinessHandle.GdnxfdTarget.IRRAD && it.WINDPOWERSTATIONID == windpowerId).Select(it => it.CODE).FirstOrDefault();
|
|
|
+// else
|
|
|
+// pointIdFS = entities.WINDTURBINETESTINGPOINTAI.Where(it => it.UNIFORMCODE == BusinessHandle.GdnxfdTarget.FJFS && it.WINDTURBINEID == windturbineId).Select(it => it.ID).FirstOrDefault();
|
|
|
+//
|
|
|
+// //String pointIdZT2 = entities.WINDTURBINETESTINGPOINTDI2.Where(it => it.UNIFORMCODE == "DI064" && it.WINDTURBINEID == windturbineId).Select(it => it.ID).FirstOrDefault();
|
|
|
+//
|
|
|
+// //if (pointIdZT2 == null)
|
|
|
+// //{
|
|
|
+// // pointIdZT2 = entities.WINDTURBINETESTINGPOINTDIS2.Where(it => it.NAME.IndexOf("发电状态")>-1 && it.WINDTURBINEID == windturbineId).Select(it => it.ID).FirstOrDefault();
|
|
|
+// //}
|
|
|
+//
|
|
|
+//
|
|
|
+// CureFitting item = new Tools.CureFitting();
|
|
|
+//
|
|
|
+// item.pointIdFS = pointIdFS;
|
|
|
+// item.pointIdGL = pointIdGL;
|
|
|
+// item.pointIdZT = pointIdZT;
|
|
|
+// //item.pointIdZT2 = pointIdZT2;
|
|
|
+// item.StandardId = windturbine.STANDARDID;
|
|
|
+// windDictionary.Add(windturbineId, item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// foreach (String key in windDictionary.Keys)
|
|
|
+// {
|
|
|
+// windDictionary[key].myPoints1 = new List<MyMath.Point>();
|
|
|
+// windDictionary[key].myPointsFF1 = new List<MyMath.Point>();
|
|
|
+//
|
|
|
+// windDictionary[key].myPoints2 = new List<MyMath.Point>();
|
|
|
+// windDictionary[key].myPointsFF2 = new List<MyMath.Point>();
|
|
|
+//
|
|
|
+// if (windDictionary[key].pointIdGL == null || windDictionary[key].pointIdFS == null || windDictionary[key].pointIdZT == null)
|
|
|
+// {
|
|
|
+// Console.WriteLine(key);
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// CurveFittingBuilder(begin1, end, dimension, scale, windDictionary[key].pointIdGL, windDictionary[key].pointIdFS, windDictionary[key].pointIdZT, windDictionary[key].myPoints1, windDictionary[key].myPointsFF1, key);
|
|
|
+// CurveFittingBuilder(begin2, end, dimension, scale, windDictionary[key].pointIdGL, windDictionary[key].pointIdFS, windDictionary[key].pointIdZT, windDictionary[key].myPoints2, windDictionary[key].myPointsFF2, key);
|
|
|
+// }
|
|
|
+//
|
|
|
+// foreach (String key in windDictionary.Keys)
|
|
|
+// {
|
|
|
+//
|
|
|
+// decimal modelpower = 1500;
|
|
|
+// if (windturbineCapacity.ContainsKey(key))
|
|
|
+// {
|
|
|
+// modelpower = windturbineCapacity[key];
|
|
|
+// }
|
|
|
+//
|
|
|
+// using (GdsjEntities entities = new GdsjEntities())
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// //月的上月
|
|
|
+// List<MyMath.Point> monthPoints = new List<MyMath.Point>();
|
|
|
+// //月的去年同期
|
|
|
+// List<MyMath.Point> yearPoints = new List<MyMath.Point>();
|
|
|
+// //月标准功率
|
|
|
+// List<MyMath.Point> standardPoints = new List<MyMath.Point>();
|
|
|
+//
|
|
|
+//
|
|
|
+// //日的昨天
|
|
|
+// List<MyMath.Point> monthdayPoints = new List<MyMath.Point>();
|
|
|
+// //日的去年同期
|
|
|
+// List<MyMath.Point> yeardayPoints = new List<MyMath.Point>();
|
|
|
+// //日标准功率
|
|
|
+// List<MyMath.Point> standarddayPoints = new List<MyMath.Point>();
|
|
|
+//
|
|
|
+// //保证功率
|
|
|
+// List<MyMath.Point> powerPoints = new List<MyMath.Point>();
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if (windTurbineDictionary.ContainsKey(key))
|
|
|
+// {
|
|
|
+// String standardId = windTurbineDictionary[key].STANDARDID;
|
|
|
+// if (!String.IsNullOrEmpty(standardId))
|
|
|
+// {
|
|
|
+// if (windDictionary.ContainsKey(key))
|
|
|
+// {
|
|
|
+// standardPoints = windDictionary[standardId].myPoints1;
|
|
|
+// standarddayPoints = windDictionary[standardId].myPoints2;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// String stringyear = year.ToString();
|
|
|
+// String stringmonth = month.ToString();
|
|
|
+//
|
|
|
+// String stringyear2 = year2.ToString();
|
|
|
+// String stringmonth2 = month2.ToString();
|
|
|
+//
|
|
|
+// String stringyear3 = year3.ToString();
|
|
|
+// String stringmonth3 = month3.ToString();
|
|
|
+//
|
|
|
+// var data = (from c in entities.WINDTURBINECURVEFITTINGMONTH
|
|
|
+// where (c.WINDTURBINEID == key && c.YEAR == stringyear2 && c.MONTH == stringmonth2)
|
|
|
+// select c).OrderBy(it => it.SPEED).ToList();
|
|
|
+//
|
|
|
+// BuildPoints(data, monthPoints);
|
|
|
+// data = null;
|
|
|
+// data = (from c in entities.WINDTURBINECURVEFITTINGMONTH
|
|
|
+// where (c.WINDTURBINEID == key && c.YEAR == stringyear3 && c.MONTH == stringmonth3)
|
|
|
+// select c).OrderBy(it => it.SPEED).ToList();
|
|
|
+//
|
|
|
+// BuildPoints(data, yearPoints);
|
|
|
+//
|
|
|
+// Date d1 = current.AddDays(-1);
|
|
|
+// Date d2 = current.AddYears(-1);
|
|
|
+//
|
|
|
+// var data2 = (from c in entities.WINDTURBINECURVEFITTING
|
|
|
+// where (c.WINDTURBINEID == key && c.RECORDDATE.Value.CompareTo(d1) == 0)
|
|
|
+// select c).ToList();
|
|
|
+//
|
|
|
+// BuildPoints(data2, monthdayPoints);
|
|
|
+//
|
|
|
+// data2 = null;
|
|
|
+// data2 = (from c in entities.WINDTURBINECURVEFITTING
|
|
|
+// where (c.WINDTURBINEID == key && c.RECORDDATE.Value.CompareTo(d2) == 0)
|
|
|
+// select c).ToList();
|
|
|
+//
|
|
|
+// BuildPoints(data2, monthPoints);
|
|
|
+//
|
|
|
+// if (windTurbineDictionary.ContainsKey(key))
|
|
|
+// {
|
|
|
+// String modelid = windTurbineDictionary[key].MODELID;
|
|
|
+// if (!String.IsNullOrEmpty(modelid))
|
|
|
+// {
|
|
|
+// if (modelPowerDictionary.ContainsKey(modelid))
|
|
|
+// {
|
|
|
+// foreach (var speed in modelPowerDictionary[modelid].Keys)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = (double)speed;
|
|
|
+// point.Y = (double)modelPowerDictionary[modelid][speed].ENSUREPOWER.Value;
|
|
|
+// powerPoints.Add(point);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// CURVEFITTINGMONTHMAIN main1 = (from c in entities.CURVEFITTINGMONTHMAIN
|
|
|
+// where (c.WINDTURBINEID == key && c.YEAR == stringyear && c.MONTH == stringmonth)
|
|
|
+// select c).FirstOrDefault();
|
|
|
+// if (main1 == null)
|
|
|
+// {
|
|
|
+// main1 = new CURVEFITTINGMONTHMAIN();
|
|
|
+// main1.ID = Guid.NewGuid().ToString();
|
|
|
+// main1.WINDTURBINEID = key;
|
|
|
+// main1.YEAR = year.ToString();
|
|
|
+// main1.MONTH = month.ToString();
|
|
|
+// entities.AddToCURVEFITTINGMONTHMAIN(main1);
|
|
|
+// }
|
|
|
+// //月---实际/最优
|
|
|
+// main1.DEVIATIONRATE1 = (decimal)pcl(windDictionary[key].myPoints1, windDictionary[key].myPointsFF1, modelpower);
|
|
|
+// //月---实际/保证
|
|
|
+// main1.DEVIATIONRATE2 = (decimal)pcl(windDictionary[key].myPoints1, powerPoints, modelpower);
|
|
|
+// //月---最优/保证
|
|
|
+// main1.DEVIATIONRATE3 = (decimal)pcl(windDictionary[key].myPointsFF1, powerPoints, modelpower);
|
|
|
+// //月---实际/上月实际
|
|
|
+// main1.MONTHDEVIATIONRATE = (decimal)pcl(windDictionary[key].myPoints1, monthPoints, modelpower);
|
|
|
+// //月---实际/同期实际
|
|
|
+// main1.YEARDEVIATIONRATE = (decimal)pcl(windDictionary[key].myPoints1, yearPoints, modelpower);
|
|
|
+// //月---实际/标杆实际
|
|
|
+// main1.STANDARDDEVIATIONRATE = (decimal)pcl(windDictionary[key].myPoints1, standardPoints, modelpower);
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// CURVEFITTINGMAIN main2 = (from c in entities.CURVEFITTINGMAIN
|
|
|
+// where (c.WINDTURBINEID == key && c.RECORDDATE.Value.CompareTo(current) == 0)
|
|
|
+// select c).FirstOrDefault();
|
|
|
+// if (main2 == null)
|
|
|
+// {
|
|
|
+// main2 = new CURVEFITTINGMAIN();
|
|
|
+// main2.ID = Guid.NewGuid().ToString();
|
|
|
+// main2.WINDTURBINEID = key;
|
|
|
+// main2.RECORDDATE = current;
|
|
|
+//
|
|
|
+// entities.AddToCURVEFITTINGMAIN(main2);
|
|
|
+//
|
|
|
+// }
|
|
|
+// //日---实际/最优
|
|
|
+// main2.DEVIATIONRATE1 = (decimal)pcl(windDictionary[key].myPoints2, windDictionary[key].myPointsFF2, modelpower);
|
|
|
+// //日---实际/保证
|
|
|
+// main2.DEVIATIONRATE2 = (decimal)pcl(windDictionary[key].myPoints2, powerPoints, modelpower);
|
|
|
+// //日---最优/保证
|
|
|
+// main2.DEVIATIONRATE3 = (decimal)pcl(windDictionary[key].myPointsFF2, powerPoints, modelpower);
|
|
|
+// //日---实际/上日实际
|
|
|
+// main2.MONTHDEVIATIONRATE = (decimal)pcl(windDictionary[key].myPoints2, monthdayPoints, modelpower);
|
|
|
+// //日---实际/同期实际
|
|
|
+// main2.YEARDEVIATIONRATE = (decimal)pcl(windDictionary[key].myPoints2, yeardayPoints, modelpower);
|
|
|
+// //日---实际/标杆实际
|
|
|
+// main2.STANDARDDEVIATIONRATE = (decimal)pcl(windDictionary[key].myPoints2, standarddayPoints, modelpower);
|
|
|
+//
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 3, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 4, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 5, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 6, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 7, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 8, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 9, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 10, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 11, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 12, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+// PLCBuild(entities, key, stringyear, stringmonth, current, windDictionary, modelpower, 13, powerPoints, monthPoints, yearPoints, standardPoints, monthdayPoints, yeardayPoints, standarddayPoints);
|
|
|
+//
|
|
|
+//
|
|
|
+// if (insertType == 0)
|
|
|
+// {
|
|
|
+// InsertPoints(current, stringyear, stringmonth, entities, windDictionary[key].myPoints1, windDictionary[key].myPointsFF1, windDictionary[key].myPoints2, windDictionary[key].myPointsFF2, key);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// InsertPoints2(current, stringyear, stringmonth, entities, windDictionary[key].myPoints1, windDictionary[key].myPointsFF1, windDictionary[key].myPoints2, windDictionary[key].myPointsFF2, key);
|
|
|
+// }
|
|
|
+// Console.WriteLine(key);
|
|
|
+// int z = entities.SaveChanges(false);
|
|
|
+// logger.Info(String.Format("{1}:更新sqlserver数据库记录数:{0}", z, Date.Now));
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// public void PLCBuild(GdsjEntities entities, String key, String stringyear, String stringmonth, Date current, Dictionary<String, CureFitting> windDictionary, decimal modelpower, double speed,
|
|
|
+// List<MyMath.Point> powerPoints, List<MyMath.Point> monthPoints, List<MyMath.Point> yearPoints, List<MyMath.Point> standardPoints, List<MyMath.Point> monthdayPoints, List<MyMath.Point> yeardayPoints, List<MyMath.Point> standarddayPoints)
|
|
|
+// {
|
|
|
+//
|
|
|
+// String speedStr = speed.ToString();
|
|
|
+//
|
|
|
+// CURVEFITTINGMONTHSUB main1 = (from c in entities.CURVEFITTINGMONTHSUB
|
|
|
+// where (c.WINDTURBINEID == key && c.YEAR == stringyear && c.MONTH == stringmonth && c.SPEED == speedStr)
|
|
|
+// select c).FirstOrDefault();
|
|
|
+// if (main1 == null)
|
|
|
+// {
|
|
|
+// main1 = new CURVEFITTINGMONTHSUB();
|
|
|
+// main1.ID = Guid.NewGuid().ToString();
|
|
|
+// main1.WINDTURBINEID = key;
|
|
|
+// main1.YEAR = stringyear;
|
|
|
+// main1.MONTH = stringmonth;
|
|
|
+// main1.SPEED = speed.ToString();
|
|
|
+// entities.AddToCURVEFITTINGMONTHSUB(main1);
|
|
|
+// }
|
|
|
+// //月---实际/最优
|
|
|
+// main1.DEVIATIONRATE1 = (decimal)pcl2(windDictionary[key].myPoints1, windDictionary[key].myPointsFF1, modelpower, speed);
|
|
|
+// //月---实际/保证
|
|
|
+// main1.DEVIATIONRATE2 = (decimal)pcl2(windDictionary[key].myPoints1, powerPoints, modelpower, speed);
|
|
|
+// //月---最优/保证
|
|
|
+// main1.DEVIATIONRATE3 = (decimal)pcl2(windDictionary[key].myPointsFF1, powerPoints, modelpower, speed);
|
|
|
+// //月---实际/上月实际
|
|
|
+// main1.MONTHDEVIATIONRATE = (decimal)pcl2(windDictionary[key].myPoints1, monthPoints, modelpower, speed);
|
|
|
+// //月---实际/同期实际
|
|
|
+// main1.YEARDEVIATIONRATE = (decimal)pcl2(windDictionary[key].myPoints1, yearPoints, modelpower, speed);
|
|
|
+// //月---实际/标杆实际
|
|
|
+// main1.STANDARDDEVIATIONRATE = (decimal)pcl2(windDictionary[key].myPoints1, standardPoints, modelpower, speed);
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// CURVEFITTINGSUB main2 = (from c in entities.CURVEFITTINGSUB
|
|
|
+// where (c.WINDTURBINEID == key && c.RECORDDATE.Value.CompareTo(current) == 0 && c.SPEED == speedStr)
|
|
|
+// select c).FirstOrDefault();
|
|
|
+// if (main2 == null)
|
|
|
+// {
|
|
|
+// main2 = new CURVEFITTINGSUB();
|
|
|
+// main2.ID = Guid.NewGuid().ToString();
|
|
|
+// main2.WINDTURBINEID = key;
|
|
|
+// main2.RECORDDATE = current;
|
|
|
+// main2.SPEED = speed.ToString();
|
|
|
+// entities.AddToCURVEFITTINGSUB(main2);
|
|
|
+//
|
|
|
+// }
|
|
|
+// //日---实际/最优
|
|
|
+// main2.DEVIATIONRATE1 = (decimal)pcl2(windDictionary[key].myPoints2, windDictionary[key].myPointsFF2, modelpower, speed);
|
|
|
+// //日---实际/保证
|
|
|
+// main2.DEVIATIONRATE2 = (decimal)pcl2(windDictionary[key].myPoints2, powerPoints, modelpower, speed);
|
|
|
+// //日---最优/保证
|
|
|
+// main2.DEVIATIONRATE3 = (decimal)pcl2(windDictionary[key].myPointsFF2, powerPoints, modelpower, speed);
|
|
|
+// //日---实际/上日实际
|
|
|
+// main2.MONTHDEVIATIONRATE = (decimal)pcl2(windDictionary[key].myPoints2, monthdayPoints, modelpower, speed);
|
|
|
+// //日---实际/同期实际
|
|
|
+// main2.YEARDEVIATIONRATE = (decimal)pcl2(windDictionary[key].myPoints2, yeardayPoints, modelpower, speed);
|
|
|
+// //日---实际/标杆实际
|
|
|
+// main2.STANDARDDEVIATIONRATE = (decimal)pcl2(windDictionary[key].myPoints2, standarddayPoints, modelpower, speed);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// private void InsertPoints(Date current, String year, String month, GdsjEntities entities, List<MyMath.Point> pointsF1, List<MyMath.Point> pointsFF1, List<MyMath.Point> pointsF2, List<MyMath.Point> pointsFF2, String windturbineId)
|
|
|
+// {
|
|
|
+// var data = (from c in entities.WINDTURBINECURVEFITTINGMONTH
|
|
|
+// where (c.WINDTURBINEID == windturbineId && c.YEAR == year && c.MONTH == month)
|
|
|
+// select c).ToList();
|
|
|
+//
|
|
|
+// for (int i = 0; i < data.Count; i++)
|
|
|
+// {
|
|
|
+// entities.DeleteObject(data[i]);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (pointsF1.Count == pointsFF1.Count)
|
|
|
+// {
|
|
|
+// for (int i = 0; i < pointsF1.Count; i++)
|
|
|
+// {
|
|
|
+// WINDTURBINECURVEFITTINGMONTH item = new WINDTURBINECURVEFITTINGMONTH();
|
|
|
+// item.WINDTURBINEID = windturbineId;
|
|
|
+//
|
|
|
+// if (type == "GDC")
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// item.SPEED = decimal.Truncate((decimal)pointsF1[i].X);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+// item.SPEED = (decimal)pointsF1[i].X;
|
|
|
+// }
|
|
|
+// item.ACTUALPOWER = (decimal)pointsF1[i].Y;
|
|
|
+// item.OPTIMALPOWER = (decimal)pointsFF1[i].Y;
|
|
|
+// item.YEAR = year.ToString();
|
|
|
+// item.MONTH = month.ToString();
|
|
|
+// entities.AddToWINDTURBINECURVEFITTINGMONTH(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+// logger.WarnFormat(String.Format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, pointsF1.Count, pointsFF1.Count));
|
|
|
+//
|
|
|
+// for (int i = 0; i < pointsF1.Count; i++)
|
|
|
+// {
|
|
|
+// WINDTURBINECURVEFITTINGMONTH item = new WINDTURBINECURVEFITTINGMONTH();
|
|
|
+// item.WINDTURBINEID = windturbineId;
|
|
|
+// if (type == "GDC")
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// item.SPEED = decimal.Truncate((decimal)pointsF1[i].X);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+// item.SPEED = (decimal)pointsF1[i].X;
|
|
|
+// }
|
|
|
+// item.ACTUALPOWER = (decimal)pointsF1[i].Y;
|
|
|
+// item.OPTIMALPOWER = (decimal)pointsFF1.Where(it => it.X == pointsF1[i].X).Select(it => it.Y).FirstOrDefault();
|
|
|
+// item.YEAR = year.ToString();
|
|
|
+// item.MONTH = month.ToString();
|
|
|
+// entities.AddToWINDTURBINECURVEFITTINGMONTH(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// var data2 = (from c in entities.WINDTURBINECURVEFITTING
|
|
|
+// where (c.WINDTURBINEID == windturbineId && c.RECORDDATE.Value.CompareTo(current) == 0)
|
|
|
+// select c).ToList();
|
|
|
+//
|
|
|
+//
|
|
|
+// for (int i = 0; i < data2.Count; i++)
|
|
|
+// {
|
|
|
+// entities.DeleteObject(data2[i]);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (pointsF2.Count == pointsFF2.Count)
|
|
|
+// {
|
|
|
+// for (int i = 0; i < pointsF2.Count; i++)
|
|
|
+// {
|
|
|
+// WINDTURBINECURVEFITTING item = new WINDTURBINECURVEFITTING();
|
|
|
+// item.WINDTURBINEID = windturbineId;
|
|
|
+// if (type == "GDC")
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// item.SPEED = decimal.Truncate((decimal)pointsF2[i].X);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// bool l = pointsF2[i].X.ToString().Contains(".");
|
|
|
+// if (l)
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// item.SPEED = (decimal)pointsF2[i].X;
|
|
|
+// }
|
|
|
+// item.ACTUALPOWER = (int)pointsF2[i].Y;
|
|
|
+// item.OPTIMALPOWER = (int)pointsFF2[i].Y;
|
|
|
+// item.RECORDDATE = current;
|
|
|
+//
|
|
|
+// entities.AddToWINDTURBINECURVEFITTING(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// logger.WarnFormat(String.Format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, pointsF2.Count, pointsFF2.Count));
|
|
|
+//
|
|
|
+// for (int i = 0; i < pointsF2.Count; i++)
|
|
|
+// {
|
|
|
+// WINDTURBINECURVEFITTING item = new WINDTURBINECURVEFITTING();
|
|
|
+// item.WINDTURBINEID = windturbineId;
|
|
|
+// if (type == "GDC")
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// item.SPEED = decimal.Truncate((decimal)pointsF2[i].X);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// bool l = pointsF2[i].X.ToString().Contains(".");
|
|
|
+// if (l)
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// item.SPEED = (decimal)pointsF2[i].X;
|
|
|
+// }
|
|
|
+// item.ACTUALPOWER = (int)pointsF2[i].Y;
|
|
|
+// item.OPTIMALPOWER = (int)pointsFF2.Where(it => it.X == pointsF2[i].X).Select(it => it.Y).FirstOrDefault();
|
|
|
+// item.RECORDDATE = current;
|
|
|
+//
|
|
|
+// entities.AddToWINDTURBINECURVEFITTING(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// private void InsertPoints2(Date current, String year, String month, GdsjEntities entities, List<MyMath.Point> pointsF1, List<MyMath.Point> pointsFF1, List<MyMath.Point> pointsF2, List<MyMath.Point> pointsFF2, String windturbineId)
|
|
|
+// {
|
|
|
+// var data = (from c in entities.WINDTURBINEPOWERCURVEFITTING
|
|
|
+// where (c.WINDTURBINEID == windturbineId)
|
|
|
+// select c).ToList();
|
|
|
+//
|
|
|
+// for (int i = 0; i < data.Count; i++)
|
|
|
+// {
|
|
|
+// entities.DeleteObject(data[i]);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (pointsF1.Count == pointsFF1.Count)
|
|
|
+// {
|
|
|
+// for (int i = 0; i < pointsF1.Count; i++)
|
|
|
+// {
|
|
|
+// WINDTURBINEPOWERCURVEFITTING item = new WINDTURBINEPOWERCURVEFITTING();
|
|
|
+// item.ID = Guid.NewGuid().ToString();
|
|
|
+// item.WINDTURBINEID = windturbineId;
|
|
|
+//
|
|
|
+// if (type == "GDC")
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// item.SPEED = decimal.Truncate((decimal)pointsF1[i].X);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// bool l = pointsF1[i].X.ToString().Contains(".");
|
|
|
+// if (l)
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// item.SPEED = (decimal)pointsF1[i].X;
|
|
|
+// }
|
|
|
+// item.ACTUALPOWER = (decimal)pointsF1[i].Y;
|
|
|
+// item.OPTIMALPOWER = (decimal)pointsFF1[i].Y;
|
|
|
+//
|
|
|
+// entities.AddToWINDTURBINEPOWERCURVEFITTING(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+// logger.WarnFormat(String.Format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, pointsF1.Count, pointsFF1.Count));
|
|
|
+//
|
|
|
+// for (int i = 0; i < pointsF1.Count; i++)
|
|
|
+// {
|
|
|
+// WINDTURBINEPOWERCURVEFITTING item = new WINDTURBINEPOWERCURVEFITTING();
|
|
|
+// item.ID = Guid.NewGuid().ToString();
|
|
|
+// item.WINDTURBINEID = windturbineId;
|
|
|
+// if (type == "GDC")
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// item.SPEED = decimal.Truncate((decimal)pointsF1[i].X);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// bool l = pointsF1[i].X.ToString().Contains(".");
|
|
|
+// if (l)
|
|
|
+// {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// item.SPEED = (decimal)pointsF1[i].X;
|
|
|
+// }
|
|
|
+// item.ACTUALPOWER = (decimal)pointsF1[i].Y;
|
|
|
+// item.OPTIMALPOWER = (decimal)pointsFF1.Where(it => it.X == pointsF1[i].X).Select(it => it.Y).FirstOrDefault();
|
|
|
+//
|
|
|
+// entities.AddToWINDTURBINEPOWERCURVEFITTING(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// private void BuildPoints(List<WINDTURBINECURVEFITTINGMONTH> data, List<MyMath.Point> points)
|
|
|
+// {
|
|
|
+// if (data != null)
|
|
|
+// {
|
|
|
+// for (int i = 0; i < data.Count; i++)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = (double)data[i].SPEED.Value;
|
|
|
+// point.Y = (double)data[i].ACTUALPOWER.Value;
|
|
|
+// points.Add(point);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// private void BuildPoints(List<WINDTURBINECURVEFITTING> data, List<MyMath.Point> points)
|
|
|
+// {
|
|
|
+// if (data != null)
|
|
|
+// {
|
|
|
+// for (int i = 0; i < data.Count; i++)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = (double)data[i].SPEED.Value;
|
|
|
+// point.Y = (double)data[i].ACTUALPOWER.Value;
|
|
|
+// points.Add(point);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// //曲线偏差率
|
|
|
+// private double pcl(List<MyMath.Point> Points1, List<MyMath.Point> Points2, decimal modelpower)
|
|
|
+// {
|
|
|
+// double result = -0;
|
|
|
+// double pc = 0;
|
|
|
+// if (Points1 != null && Points1.Count != 0 && Points2 != null && Points2.Count != 0)
|
|
|
+// {
|
|
|
+// double count = 0;
|
|
|
+// double sum = 0;
|
|
|
+// double max = (double)modelpower;
|
|
|
+// foreach (MyMath.Point point in Points1)
|
|
|
+// {
|
|
|
+// var item = Points2.Where(it => it.X == point.X).ToList();
|
|
|
+// if (item != null && item.Count > 0)
|
|
|
+// {
|
|
|
+// sum += Math.Pow((point.Y - item[0].Y), 2);
|
|
|
+// count++;
|
|
|
+// pc += point.Y - item[0].Y;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// sum = Math.Sqrt(sum);
|
|
|
+// count = Math.Sqrt(count);
|
|
|
+// max = max * count;
|
|
|
+// if (max != 0)
|
|
|
+// {
|
|
|
+// result = sum / max * 100;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (pc < 0)
|
|
|
+// {
|
|
|
+// result = 0 - result;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// //曲线偏差率2
|
|
|
+// private double pcl2(List<MyMath.Point> Points1, List<MyMath.Point> Points2, decimal modelpower, double speed)
|
|
|
+// {
|
|
|
+// double minSpeed = speed;
|
|
|
+// double maxSpeed = minSpeed + 1;
|
|
|
+// double result = -0;
|
|
|
+// double pc = 0;
|
|
|
+// if (Points1 != null && Points1.Count != 0 && Points2 != null && Points2.Count != 0)
|
|
|
+// {
|
|
|
+// double count = 0;
|
|
|
+// double sum = 0;
|
|
|
+// double max = (double)modelpower;
|
|
|
+// foreach (MyMath.Point point in Points1)
|
|
|
+// {
|
|
|
+// var item = Points2.Where(it => it.X == point.X).ToList();
|
|
|
+// if (item != null && item.Count > 0 && item[0].X >= minSpeed && item[0].X < maxSpeed)
|
|
|
+// {
|
|
|
+// sum += Math.Pow((point.Y - item[0].Y), 2);
|
|
|
+// count++;
|
|
|
+// pc += point.Y - item[0].Y;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// sum = Math.Sqrt(sum);
|
|
|
+// count = Math.Sqrt(count);
|
|
|
+// max = max * count;
|
|
|
+// if (max != 0)
|
|
|
+// {
|
|
|
+// result = sum / max * 100;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (pc < 0)
|
|
|
+// {
|
|
|
+// result = 0 - result;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// //功率曲线拟合
|
|
|
+// public void CurveFittingBuilder(Date begin, Date end, int dimension, double scale, String pointIdGL, String pointIdFS, String pointIdZT, List<MyMath.Point> myPoints, List<MyMath.Point> myPointsFF, String windturbineId)
|
|
|
+// {
|
|
|
+// double maxPower = (double)windturbineCapacity[windturbineId] * 1.3;
|
|
|
+// List<PointF> pointsF = new List<PointF>();
|
|
|
+// Dictionary<float, PointF> pointsFF = new Dictionary<float, PointF>();
|
|
|
+//
|
|
|
+// if (end > begin)
|
|
|
+// {
|
|
|
+// if (String.Empty != pointIdGL && String.Empty != pointIdFS)
|
|
|
+// {
|
|
|
+// var glpoints = ednaHelper.GetHisData(pointIdGL, begin, end);
|
|
|
+// var fspoints = ednaHelper.GetHisData(pointIdFS, begin, end);
|
|
|
+// var ztpoints = ednaHelper.GetHisData(pointIdZT, begin, end);
|
|
|
+//
|
|
|
+// //var ztpoints2 = GoldenHelper.GetHisData(pointIdZT2, begin, end);
|
|
|
+//
|
|
|
+// //Console.WriteLine(ztpoints2);
|
|
|
+//
|
|
|
+//
|
|
|
+// if (glpoints.Count != fspoints.Count || glpoints.Count != ztpoints.Count)
|
|
|
+// {
|
|
|
+// for (int i = 0; i < fspoints.Count; i++)
|
|
|
+// {
|
|
|
+// double x = double.Parse(fspoints[i].value.ToString());
|
|
|
+// double y = -1;
|
|
|
+// double z = -1;
|
|
|
+// double z1 = -1;
|
|
|
+// var yArray = glpoints.Where(it => it.time == fspoints[i].time).ToList();
|
|
|
+// if (yArray != null && yArray.Count > 0)
|
|
|
+// {
|
|
|
+//
|
|
|
+// y = double.Parse(yArray[0].value.ToString());
|
|
|
+// }
|
|
|
+//
|
|
|
+// yArray = ztpoints.Where(it => it.time == fspoints[i].time).ToList();
|
|
|
+// if (yArray != null && yArray.Count > 0)
|
|
|
+// {
|
|
|
+//
|
|
|
+// z = double.Parse(yArray[0].value.ToString());
|
|
|
+// }
|
|
|
+//
|
|
|
+// //yArray = ztpoints2.Where(it => it.time == fspoints[i].time).ToList();
|
|
|
+// //if (yArray != null && yArray.Count > 0)
|
|
|
+// //{
|
|
|
+// // z1 = double.Parse(yArray[0].value.ToString());
|
|
|
+// //}
|
|
|
+//
|
|
|
+// float x1 = (float)Math.Round(x, 2);
|
|
|
+// float y1 = (float)y;
|
|
|
+//
|
|
|
+//
|
|
|
+// bool b = true;
|
|
|
+// if (type == "GDC")
|
|
|
+// b = (x >= 0 && y > 0);
|
|
|
+// else
|
|
|
+// if (z == 2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// b = (x >= 0 && x <= 30 && y >= 0 && y <= maxPower);
|
|
|
+//
|
|
|
+// if (b)
|
|
|
+// {
|
|
|
+// if (x > 3 && y <= 0)
|
|
|
+// {
|
|
|
+// b = false;
|
|
|
+// }
|
|
|
+// if (x <= 3 && y > 0)
|
|
|
+// {
|
|
|
+// b = false;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// b = false;
|
|
|
+// }
|
|
|
+// if (b)
|
|
|
+// {
|
|
|
+// pointsF.Add(new PointF(x1, y1));
|
|
|
+//
|
|
|
+// if (pointsFF.ContainsKey(x1))
|
|
|
+// {
|
|
|
+// if (pointsFF[x1].Y < y1)
|
|
|
+// {
|
|
|
+// pointsFF[x1] = new PointF(x1, y1);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// pointsFF.Add(x1, new PointF(x1, y1));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+// for (int i = 0; i < fspoints.Count; i++)
|
|
|
+// {
|
|
|
+// double x = double.Parse(fspoints[i].value.ToString());
|
|
|
+// double y = double.Parse(glpoints[i].value.ToString());
|
|
|
+// double z = double.Parse(ztpoints[i].value.ToString());
|
|
|
+// //double z1 = double.Parse(ztpoints2[i].value.ToString());
|
|
|
+//
|
|
|
+// float x1 = (float)Math.Round(x, 2);
|
|
|
+// float y1 = (float)y;
|
|
|
+//
|
|
|
+//
|
|
|
+// bool b = true;
|
|
|
+// if (type == "GDC")
|
|
|
+// b = (x >= 0 && y > 0);
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if (z == 2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// b = (x >= 0 && x <= 30 && y >= 0 && y <= maxPower);
|
|
|
+//
|
|
|
+// if (b)
|
|
|
+// {
|
|
|
+// if (x > 3 && y <= 0)
|
|
|
+// {
|
|
|
+// b = false;
|
|
|
+// }
|
|
|
+// if (x <= 3 && y > 0)
|
|
|
+// {
|
|
|
+// b = false;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// b = false;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (b)
|
|
|
+// {
|
|
|
+// pointsF.Add(new PointF(x1, y1));
|
|
|
+//
|
|
|
+// if (pointsFF.ContainsKey(x1))
|
|
|
+// {
|
|
|
+// if (pointsFF[x1].Y < y1)
|
|
|
+// {
|
|
|
+// pointsFF[x1] = new PointF(x1, y1);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// pointsFF.Add(x1, new PointF(x1, y1));
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// pointsF.Add(new PointF(0, 0));
|
|
|
+//
|
|
|
+// pointsF = pointsF.Where(it => it.X >= 3).OrderBy(it => it.X).ToList();
|
|
|
+//
|
|
|
+// var temp = MyMath.Line.BuildLine(pointsF.Select(it => (double)it.X).ToArray(), pointsF.Select(it => (double)it.Y).ToArray(), pointsF.Count, dimension, scale);
|
|
|
+//
|
|
|
+// myPoints.AddRange(temp);
|
|
|
+// if (myPoints != null && myPoints.Count != 0)
|
|
|
+// {
|
|
|
+// BuildMyPoints(myPoints, scale);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if (!pointsFF.ContainsKey(0))
|
|
|
+// pointsFF.Add(0, new PointF(0, 0));
|
|
|
+//
|
|
|
+// List<PointF> FF = pointsFF.Values.Where(it => it.X >= 3).OrderBy(it => it.X).ToList();
|
|
|
+// if (FF != null && FF.Count != 0)
|
|
|
+// {
|
|
|
+// temp = MyMath.Line.BuildLine(FF.Select(it => (double)it.X).ToArray(), FF.Select(it => (double)it.Y).ToArray(), FF.Count, dimension, scale);
|
|
|
+// }
|
|
|
+// myPointsFF.AddRange(temp);
|
|
|
+// if (myPointsFF != null && myPointsFF.Count != 0)
|
|
|
+// {
|
|
|
+// BuildMyPoints(myPointsFF, scale);
|
|
|
+// }
|
|
|
+//
|
|
|
+// myPoints = myPoints.Where(it => it.X >= 0 && it.X <= 25).OrderBy(it => it.X).ToList();
|
|
|
+//
|
|
|
+// myPointsFF = myPointsFF.Where(it => it.X >= 0 && it.X <= 25).OrderBy(it => it.X).ToList();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private static void BuildMyPoints(List<MyMath.Point> myPoints, double scale)
|
|
|
+// {
|
|
|
+// int coefficient = 1;
|
|
|
+// int dec = 0;
|
|
|
+// int smax = 25;
|
|
|
+// if (scale == 0.01)
|
|
|
+// {
|
|
|
+// coefficient = 100;
|
|
|
+// dec = 2;
|
|
|
+// }
|
|
|
+// if (scale == 0.1)
|
|
|
+// {
|
|
|
+// coefficient = 10;
|
|
|
+// dec = 1;
|
|
|
+// }
|
|
|
+//
|
|
|
+// smax *= coefficient;
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// double min = myPoints.Min(it => it.X) * coefficient;
|
|
|
+// double max = myPoints.Max(it => it.X) * coefficient;
|
|
|
+//
|
|
|
+// double maxval = myPoints.Max(it => it.Y);
|
|
|
+//
|
|
|
+// for (double i = 0; i < min; i += 1)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = Math.Round(i / coefficient, dec);
|
|
|
+// point.Y = 0;
|
|
|
+// myPoints.Add(point);
|
|
|
+// }
|
|
|
+// //var tt = myPoints.Where(it => it.X == 3).ToList();
|
|
|
+//
|
|
|
+// //Console.WriteLine(tt);
|
|
|
+//
|
|
|
+// for (double i = smax; i > max; i -= 1)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = Math.Round(i / coefficient, dec);
|
|
|
+// point.Y = maxval;
|
|
|
+// myPoints.Add(point);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private static void BuildMyPoints2(List<MyMath.Point> myPoints)
|
|
|
+// {
|
|
|
+// double min = myPoints.Min(it => it.X);
|
|
|
+// double max = myPoints.Max(it => it.X);
|
|
|
+//
|
|
|
+// double maxval = myPoints.Max(it => it.Y);
|
|
|
+//
|
|
|
+// for (int i = 0; i < min; i += 1)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = i;
|
|
|
+// point.Y = 0;
|
|
|
+// myPoints.Add(point);
|
|
|
+// }
|
|
|
+// //var tt = myPoints.Where(it => it.X == 3).ToList();
|
|
|
+//
|
|
|
+// //Console.WriteLine(tt);
|
|
|
+//
|
|
|
+// for (int i = 25; i > max; i -= 1)
|
|
|
+// {
|
|
|
+// MyMath.Point point = new MyMath.Point();
|
|
|
+// point.X = i;
|
|
|
+// point.Y = maxval;
|
|
|
+// myPoints.Add(point);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|
|
|
+//}
|