//public bool HasBuffyCoat() //{ // string reportPath = ConfigurationManager.AppSettings[stringRes.reportPath]; // int pos = reportPath.LastIndexOf('\\'); // string sDir = reportPath.Substring(0, pos); // string sPath = sDir + "\\hasBuffy.txt"; // bool bHasBuffy = false; // if (!File.Exists(sPath)) // return false; // using (StreamReader sr = new StreamReader(sPath)) // { // string s = sr.ReadLine(); // bHasBuffy = bool.Parse(s); // } // return bHasBuffy; //} public List <DetectedHeight> Read() { //SciRobotHelper sciRobotHelper = new SciRobotHelper(); //List<DetectedHeight> heights = new List<DetectedHeight>(); ////check capacity //sciRobotHelper.ReadZValues(ref heights); //return heights; List <DetectedHeight> heights = new List <DetectedHeight>(); string reportPath = ConfigurationManager.AppSettings[stringRes.reportPath]; using (StreamReader sr = new StreamReader(reportPath)) { string sContent = ""; bool bFirstRow = true; int curRow = 0; while (true) { sContent = sr.ReadLine(); if (sContent == null) { break; } if (sContent == "") { continue; } if (bFirstRow) { bFirstRow = false; continue; } DetectedHeight detectedHeight = new DetectedHeight(); int infoIndex = (curRow - 1); string[] vals = sContent.Split(','); detectedHeight.Z1 = double.Parse(vals[1]) / 10; //convert to mm, tiu result is 1/10 mm detectedHeight.Z2 = double.Parse(vals[2]) / 10; heights.Add(detectedHeight); if (detectedHeight.Z1 < 0 || detectedHeight.Z2 < 0) { throw new Exception("Z1,Z2 cannot be smaller than 0 at line: " + heights.Count.ToString()); } curRow++; } } return(heights); }
public List <DetectedHeight> Read() { string sReportXml = ConfigurationManager.AppSettings[stringRes.reportPath]; DataSet ds = new DataSet(); ds.ReadXml(sReportXml); DataTable dt = ds.Tables[0]; List <DetectedHeight> heights = new List <DetectedHeight>(); Dictionary <int, string> nameValDict = new Dictionary <int, string>(); for (int i = 0; i < dt.Columns.Count; i++) { nameValDict.Add(i, dt.Columns[i].Caption); } foreach (DataRow dr in dt.Rows) { DetectedHeight detectResult = new DetectedHeight(); for (int i = 0; i < dr.ItemArray.Count(); i++) { if (nameValDict[i] == "Z1") { detectResult.Z1 = 10 * double.Parse(dr.ItemArray[i].ToString()); } if (nameValDict[i] == "Z2") { detectResult.Z2 = 10 * double.Parse(dr.ItemArray[i].ToString()); } } if (detectResult.Z1 < detectResult.Z2) { throw new Exception("Z1 must be greater than Z2"); } heights.Add(detectResult); } return(heights); }
private List<DetectedHeight> ModifyHeights( List<DetectedHeight> heightsThisTime) { List<DetectedHeight> newHeights = new List<DetectedHeight>(); double r = pipettingSetting.r_mm; double area = 3.14159265 * r * r; double redCellBuffyDistance = pipettingSetting.buffyVolume / area; foreach (DetectedHeight detectedInfo in heightsThisTime) { DetectedHeight newHeight = new DetectedHeight(); newHeight.Z1 = detectedInfo.Z2 - redCellBuffyDistance; newHeight.Z2 = pipettingSetting.redCellBottomHeight; newHeights.Add(newHeight); } return newHeights; }
private double CalculateTipVolume(double aspHeight, DetectedHeight detectHeight, bool isLastSlicePlasma,bool isBuffy = false) { double safeHeight = detectHeight.Z2 + pipettingSetting.safeDelta; if (isBuffy) aspHeight = detectHeight.Z2 + 1; else { //if (isLastSlicePlasma) //{ // aspHeight = safeHeight; //} //else { if (aspHeight < safeHeight) aspHeight = safeHeight; } } string sExpression = ConfigurationManager.AppSettings[stringRes.expression]; sExpression = sExpression.Replace("height_mm", aspHeight.ToString()); #if DEBUG double vol = 100 * aspHeight - 200; #else Expression e = new Expression(sExpression); double vol = double.Parse(e.Evaluate().ToString()); #endif return vol; }
//public bool HasBuffyCoat() //{ // string reportPath = ConfigurationManager.AppSettings[stringRes.reportPath]; // int pos = reportPath.LastIndexOf('\\'); // string sDir = reportPath.Substring(0, pos); // string sPath = sDir + "\\hasBuffy.txt"; // bool bHasBuffy = false; // if (!File.Exists(sPath)) // return false; // using (StreamReader sr = new StreamReader(sPath)) // { // string s = sr.ReadLine(); // bHasBuffy = bool.Parse(s); // } // return bHasBuffy; //} public List<DetectedHeight> Read() { //SciRobotHelper sciRobotHelper = new SciRobotHelper(); //List<DetectedHeight> heights = new List<DetectedHeight>(); ////check capacity //sciRobotHelper.ReadZValues(ref heights); //return heights; List<DetectedHeight> heights = new List<DetectedHeight>(); string reportPath = ConfigurationManager.AppSettings[stringRes.reportPath]; using (StreamReader sr = new StreamReader(reportPath)) { string sContent = ""; bool bFirstRow = true; int curRow = 0; while (true) { sContent = sr.ReadLine(); if (sContent == null) break; if (sContent == "") continue; if (bFirstRow) { bFirstRow = false; continue; } DetectedHeight detectedHeight = new DetectedHeight(); int infoIndex = (curRow - 1); string[] vals = sContent.Split(','); detectedHeight.Z1 = double.Parse(vals[1])/10; //convert to mm, tiu result is 1/10 mm detectedHeight.Z2 = double.Parse(vals[2])/10; heights.Add(detectedHeight); if (detectedHeight.Z1 < 0 || detectedHeight.Z2 < 0) throw new Exception("Z1,Z2 cannot be smaller than 0 at line: " + heights.Count.ToString()); curRow++; } } return heights; }
public List<DetectedHeight> Read() { string sReportXml = ConfigurationManager.AppSettings[stringRes.reportPath]; DataSet ds = new DataSet(); ds.ReadXml(sReportXml); DataTable dt = ds.Tables[0]; List<DetectedHeight> heights = new List<DetectedHeight>(); Dictionary<int, string> nameValDict = new Dictionary<int, string>(); for (int i = 0; i < dt.Columns.Count; i++) { nameValDict.Add(i, dt.Columns[i].Caption); } foreach (DataRow dr in dt.Rows) { DetectedHeight detectResult = new DetectedHeight(); for (int i = 0; i < dr.ItemArray.Count(); i++) { if (nameValDict[i] == "Z1") detectResult.Z1 = 10 * double.Parse(dr.ItemArray[i].ToString()); if (nameValDict[i] == "Z2") detectResult.Z2 = 10 * double.Parse(dr.ItemArray[i].ToString()); } if (detectResult.Z1 < detectResult.Z2) throw new Exception("Z1 must be greater than Z2"); heights.Add(detectResult); } return heights; }