public CylDataSet(string filename) : base(filename) { CylData = new CylData(filename); UncorrectedCylData = new CylData(FileName); }
public RingDataSet(string filename) : base(filename) { RawLandPoints = new CylData(filename); CorrectedLandPoints = new CylData(filename); }
public RingDataSet() { RawLandPoints = new CylData(); CorrectedLandPoints = new CylData(); }
public void CylData_defCtor() { var cd = new CylData(); Assert.IsNotNull(cd); }
public CylDataSet() { CylData = new CylData(); UncorrectedCylData = new CylData(); }
public void AdjustFeedrates(CylData depthData, CylData startData, CylData targetData, double averagingWindow) { MeasureDepthsAtJetLocations(depthData, startData, targetData, averagingWindow); AdjustFeedrates(); }
public void AdjustFeedrates(CylData depthData) { MeasureDepthsAtJetLocations(depthData); AdjustFeedrates(); }
public void MeasureDepthsAtJetLocations(CylData profileData, CylData startData, CylData targetData, double averagingWindow) { foreach (XSectionPathEntity xpe in this) { double xStart = xpe.CrossLoc - averagingWindow / 2; double xEnd = xpe.CrossLoc + averagingWindow / 2; //calc profile value double xSum = 0; int count = 0; for (int i = 1; i < profileData.Count; i++) { if ((profileData[i].ThetaDeg > xStart && profileData[i].ThetaDeg <= xEnd) || (profileData[i].ThetaDeg <= xStart && profileData[i].ThetaDeg > xEnd)) { count++; xSum += profileData[i].R; } } if (count > 0) { xSum /= count; } xpe.CurrentRadius = xSum; //calc target depth count = 0; xSum = 0; for (int i = 1; i < targetData.Count; i++) { if ((targetData[i].ThetaDeg > xStart && targetData[i].ThetaDeg <= xEnd) || (targetData[i].ThetaDeg <= xStart && targetData[i].ThetaDeg > xEnd)) { count++; xSum += targetData[i].R; } } if (count > 0) { xSum /= count; } //calc start depth count = 0; xSum = 0; for (int i = 1; i < startData.Count; i++) { if ((startData[i].ThetaDeg > xStart && startData[i].ThetaDeg <= xEnd) || (startData[i].ThetaDeg <= xStart && startData[i].ThetaDeg > xEnd)) { count++; xSum += startData[i].R; } } if (count > 0) { xSum /= count; } xpe.StartRadius = xSum; } }
static BarrelInspProfile BuildFromRings(List <InspDataSet> inspDataSets, int grooveCount) { try { var profile = new BarrelInspProfile(); var groovePointList = new List <CylData>(); var aveLandPointList = new List <CylData>(); var aveGrooveProfile = new CylData(inspDataSets[0].FileName); var minLandProfile = new CylData(inspDataSets[0].FileName); var aveLandProfile = new CylData(inspDataSets[0].FileName); foreach (InspDataSet dataset in inspDataSets) { if (dataset is RingDataSet ringData) { var inspData = ringData.CylData; var groovePoints = new CylData(inspDataSets[0].FileName); var landPoints = new CylData(inspDataSets[0].FileName); int pointCt = ringData.CylData.Count; int deltaIndex = pointCt / grooveCount; int[] grooveIndices = new int[grooveCount]; int[] landIndices = new int[grooveCount]; //get land and groove indices int grooveIndex = 0; int landIndex = 0; for (int j = 0; j < grooveCount; j++) { grooveIndex = (int)(j * deltaIndex); landIndex = (int)(j * deltaIndex + deltaIndex / 2); grooveIndices[j] = grooveIndex; landIndices[j] = landIndex; } double rGrooveAve = 0; double rLandAve = 0; var pt0 = inspData[0]; //average groove values for (int k = 0; k < grooveIndices.Length; k++) { var groovePt = inspData[grooveIndices[k]]; rGrooveAve += groovePt.R; var landPt = inspData[landIndices[k]]; rLandAve += landPt.R; } rLandAve /= grooveIndices.Length; rGrooveAve /= grooveIndices.Length; aveGrooveProfile.Add(new PointCyl(rGrooveAve, pt0.ThetaRad, pt0.Z)); aveLandProfile.Add(new PointCyl(rLandAve, pt0.ThetaRad, pt0.Z)); //use min or average land values double minR = double.MaxValue; foreach (PointCyl pt in inspData) { if (pt.R < minR) { minR = pt.R; } } var ptMin = new PointCyl(minR, pt0.ThetaRad, pt0.Z); minLandProfile.Add(ptMin); } profile.AveGrooveProfile = aveGrooveProfile; profile.AveLandProfile = aveLandProfile; profile.MinLandProfile = minLandProfile; // profile.Barrel = inspDataSets[0].Barrel; } return(profile); } catch (Exception) { throw; } }
/// <summary> /// get land points from data and assume minimum radius found is land /// </summary> /// <param name="rawSingleRing"></param> /// <returns></returns> static CylData GetLandPoints(CylData ring, int pointsPerRevolution, int grooveCount) { try { var outputList = new CylData(ring.FileName); double thMax = Math.Max(ring[0].ThetaRad, ring[ring.Count - 1].ThetaRad); double thMin = Math.Min(ring[0].ThetaRad, ring[ring.Count - 1].ThetaRad); var minPt = GetMinRadiusPt(ring); int searchHalfWindow = (int)((pointsPerRevolution / grooveCount) / 2.0); double dth = Math.PI * 2.0 / grooveCount; var landLocations = new List <double>(); landLocations.Add(minPt.ThetaRad); for (int i = 1; i < grooveCount; i++) { double land = (minPt.ThetaRad + (i * dth));// % Math.PI*2.0; if (land <= thMax && land >= thMin) { landLocations.Add(land); if (Math.Abs(land % (Math.PI * 2.0)) < .02) { landLocations.Add(0.0); } } land = (minPt.ThetaRad - (i * dth)); if (land <= thMax && land >= thMin) { landLocations.Add(land); } } landLocations.Sort(); bool useLocalMinPt = false; for (int i = 0; i < landLocations.Count; i++) { if (useLocalMinPt) { for (int j = 0; j < ring.Count - 1; j++) { var p1 = ring[j].ThetaRad; var p2 = ring[j + 1].ThetaRad; if (landLocations[i] < p2 && landLocations[i] >= p1) { int searchStart = Math.Max(0, j - searchHalfWindow); int searchEnd = Math.Min(ring.Count, j + searchHalfWindow); double minR = double.MaxValue; PointCyl localMinPt = new PointCyl(); //find local min var fit = new FitData(false, 2); //var segment = new SegmentFitData(); for (int k = searchStart; k < searchEnd; k++) { if (ring[k].R < minR) { minR = ring[k].R; localMinPt = ring[k].Clone(); } } outputList.Add(localMinPt); } } } else { for (int j = 0; j < ring.Count - 1; j++) { if (landLocations[i] < ring[j + 1].ThetaRad && landLocations[i] >= ring[j].ThetaRad) { double r = (ring[j].R + ring[j + 1].R) / 2.0; double th = (ring[j].ThetaRad + ring[j + 1].ThetaRad) / 2.0; double z = (ring[j].Z + ring[j + 1].Z) / 2.0; outputList.Add(new PointCyl(r, th, z)); } } } } outputList.SortByIndex(); return(outputList); } catch (Exception) { throw; } }