public double Get_As(double MRd, double NRd) { for (double i = -3.5; i <= -0.1; i += 0.001) { var item = new μSd_And_νSd(_geometry, _material).GetFromKof(coeffService.GetNew(i, _material.armatura.eps_ud)); var As1 = (NRd - 0.85 * _material.beton.fcd * item.kof.αv * item.kof.ξ * _geometry.d * _geometry.b) / (item.σs2 - item.σs1); var As2 = Math.Abs(MRd * 100 - 0.85 * _material.beton.fcd * item.kof.αv * item.kof.ξ * _geometry.d * _geometry.b * (_geometry.h / 2 - item.kof.ka * item.x)) / ((_geometry.h / 2 + _geometry.d1) * Math.Abs((item.σs2 + item.σs1))); if (Math.Round(As1, 2) == Math.Round(As2, 2)) { return(As1 * 2); } } for (double i = 19.9; i > -1.5; i -= 0.001) { var item = new μSd_And_νSd(_geometry, _material).GetFromKof(coeffService.GetNew(_material.beton.εcu2, i)); var As1 = (NRd - 0.85 * _material.beton.fcd * item.kof.αv * item.kof.ξ * _geometry.d * _geometry.b) / (item.σs2 - item.σs1); var As2 = Math.Abs(MRd * 100 - 0.85 * _material.beton.fcd * item.kof.αv * item.kof.ξ * _geometry.d * _geometry.b * (_geometry.h / 2 - item.kof.ka * item.x)) / ((_geometry.h / 2 + _geometry.d1) * Math.Abs((item.σs2 + item.σs1))); if (Math.Round(As1, 2) == Math.Round(As2, 2)) { return(As1 * 2); } } return(0); }
private int CheckDiagram(Generate_ω_LineForDiagram toCheck, double μRd, double νRd, int percision = 3) { var test = new List <μSd_And_νSd>(toCheck.ListOfDotsInLineOfDiagram); var νSdmax = test.Single(m => m.μSd == test.Max(n => n.μSd)).νSd; if (νRd >= νSdmax) { test.RemoveAll(n => n.νSd < νSdmax); var closestItemByM = test .Aggregate((x, y) => Math.Abs(x.μSd - μRd) < Math.Abs(y.μSd - μRd) ? x : y); if ( (Math.Round(μRd, percision) == Math.Round(closestItemByM.μSd, percision)) && (Math.Round(νRd, percision) == Math.Round(closestItemByM.νSd, percision))) { find = closestItemByM; return(0); } else if (closestItemByM.νSd > νRd) { find = closestItemByM; return(1); } else { find = closestItemByM; return(2); }; } else { test.RemoveAll(n => n.νSd > νSdmax); var closestItemByM = test .Aggregate((x, y) => Math.Abs(x.μSd - μRd) < Math.Abs(y.μSd - μRd) ? x : y); if ( (Math.Round(μRd, percision) == Math.Round(closestItemByM.μSd, percision)) && (Math.Round(νRd, percision) == Math.Round(closestItemByM.νSd, percision))) { find = closestItemByM; return(0); } else if (closestItemByM.νSd < νRd) { find = closestItemByM; return(1); } else { find = closestItemByM; return(2); }; } }