diff --git a/.vs/MES_Wind/v14/.suo b/.vs/MES_Wind/v14/.suo index 045fc0982023f5d2c9482920767da0053aa038ce..503d76618e75534e109e33d6dba8772e21bcd781 100644 Binary files a/.vs/MES_Wind/v14/.suo and b/.vs/MES_Wind/v14/.suo differ diff --git a/MES_Wind/bin/Debug/MES_Wind.vshost.exe b/MES_Wind/bin/Debug/MES_Wind.vshost.exe index 6b241bcd65a4769673693b96129ef13ae25e17ec..8f90da475a8319aa76856e089ccc9e517eeb134a 100644 Binary files a/MES_Wind/bin/Debug/MES_Wind.vshost.exe and b/MES_Wind/bin/Debug/MES_Wind.vshost.exe differ diff --git a/MES_Wind/frmMain.cs b/MES_Wind/frmMain.cs index 733dbb226d292b409261116ec93025f8866772e1..d8d64380bddcca88455a1d49bda5436a1fb2872a 100644 --- a/MES_Wind/frmMain.cs +++ b/MES_Wind/frmMain.cs @@ -49,13 +49,14 @@ namespace MES_Wind /// <returns>List of booleans with coordinates if any of them are true, line is broken</returns> /// <remarks></remarks> #endregion - public List<CheckPoint> CalcBrkPoint(double startX, double startY, double endX, double endY, double dThreshold, IMapRasterLayer Uwind_raster, IMapRasterLayer Vwind_raster) + public List<CheckPoint> CalcBrkPoint(double startX, double startY, double endX, double endY, double dThreshold, IMapRasterLayer Uwind_raster, IMapRasterLayer Vwind_raster, IMapRasterLayer clim_layer, double h) { List<CheckPoint> lineCheckPoint = new List<CheckPoint>(); double uwind = 0; double vwind = 0; double umod = 0; - double anglewind = 0; + double sinwind = 0; + double climwind = 0; double distance = Math.Sqrt((endX - startX) * (endX - startX) + (endY - startY) * (endY - startY)); double distpropD = distance / dThreshold; int distpropI = Convert.ToInt32(distpropD); @@ -83,11 +84,37 @@ namespace MES_Wind uwind = Uwind_raster.DataSet.Value[rowColumnU.Row, rowColumnU.Column]; RcIndex rowColumnV = Vwind_raster.DataSet.Bounds.ProjToCell(coords); vwind = Vwind_raster.DataSet.Value[rowColumnV.Row, rowColumnV.Column]; + RcIndex rowColumnC = Vwind_raster.DataSet.Bounds.ProjToCell(coords); + climwind = Vwind_raster.DataSet.Value[rowColumnC.Row, rowColumnC.Column]; umod = Math.Sqrt(uwind*uwind + vwind*vwind); - anglewind = Math.Atan2(uwind,vwind); + sinwind = Math.Sin(Math.Atan2(uwind,vwind)); + double C_height = 1.0; + if (umod < 20) + { //wind is too low + chkpnt.Ifbroken = false; + } + else + { // calculate prognostic and threshold windstress + double p1 = -0.00078501; + double p2 = 0.13431; + double p3 = -2.11112; + double p4 = 19.548; + double qpr = p1 * umod * umod * umod + p2 * umod * umod + p3 * umod + p4; + double qcl = p1 * climwind * climwind * climwind + p2 * climwind * climwind + p3 * climwind + p4; + double Ppr = qpr * C_height * sinwind * sinwind; + double Pcl = qcl * C_height * 1.0; + if (Ppr >= Pcl) + { + chkpnt.Ifbroken = true; + } + else + { + chkpnt.Ifbroken = false; + } + } chkpnt.X = curX; chkpnt.Y = curY; - chkpnt.Ifbroken = false; + lineCheckPoint.Add(chkpnt); } } @@ -148,6 +175,8 @@ namespace MES_Wind //extract prognostic u layer IMapRasterLayer u_rasterLayer = default(IMapRasterLayer); IMapRasterLayer v_rasterLayer = default(IMapRasterLayer); + IMapRasterLayer clim5_rasterLayer = default(IMapRasterLayer); + IMapRasterLayer clim10_rasterLayer = default(IMapRasterLayer); if (map1.GetRasterLayers().Count() == 1) { MessageBox.Show("Please add a raster layer"); @@ -157,6 +186,8 @@ namespace MES_Wind //use the first raster layer in the map u_rasterLayer = map1.GetRasterLayers()[0]; v_rasterLayer = map1.GetRasterLayers()[1]; + clim5_rasterLayer = map1.GetRasterLayers()[3]; + clim10_rasterLayer = map1.GetRasterLayers()[4]; //get the powerline line layer IMapLineLayer pwlLayer = default(IMapLineLayer); @@ -186,6 +217,7 @@ namespace MES_Wind int id = int.Parse(featureData["PW_ID"].ToString()); int year = int.Parse(featureData["Year"].ToString()); double height = double.Parse(featureData["height"].ToString()); + int power = int.Parse(featureData["Year"].ToString()); // cycle throw all points in line for (int i=1; i< points.Count; i++) { @@ -194,7 +226,14 @@ namespace MES_Wind double y1 = points[i - 1].Y; double x2 = points[i].X; double y2 = points[i].Y; - segmentCheckList = CalcBrkPoint(x1,y1,x2,y2,distThreshold,u_rasterLayer,v_rasterLayer); + if (power > 5 && power <330) + { + segmentCheckList = CalcBrkPoint(x1, y1, x2, y2, distThreshold, u_rasterLayer, v_rasterLayer, clim10_rasterLayer, height); + } + else + { + segmentCheckList = CalcBrkPoint(x1, y1, x2, y2, distThreshold, u_rasterLayer, v_rasterLayer, clim5_rasterLayer, height); + } lineCheckList.AddRange(segmentCheckList); } diff --git a/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 147137f32ceb82e088c1738cdf9d757e9d3d0565..378512da36199de4fd30a8f78c37012c1e87ce0f 100644 Binary files a/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ