| | |
| | | { |
| | | double compv = 0.0; |
| | | Type t = opcConfig.compensationZ.GetType(); |
| | | FieldInfo fi = t.GetField(string.Format("station{0}", (CommonUtil.mainForm.PlateID + 1) % 5 + 1)); |
| | | |
| | | int slotNum = (CommonUtil.mainForm.PlateID + 1) % 5 + 1; |
| | | FieldInfo fi = t.GetField(string.Format("station{0}", slotNum)); |
| | | compv = (double)fi.GetValue(opcConfig.compensationZ); |
| | | |
| | | batteryHeight[0] = HeightCompensation(batteryHeight[0], compv, stationNumber); |
| | | batteryHeight[0] = HeightCompensation(batteryHeight[0], compv, slotNum); |
| | | |
| | | //batteryHeight[0] += compv; |
| | | ////batteryHeight[1] += compv; |
| | |
| | | |
| | | static object _heightRawDataLock = new object(); |
| | | TaskFactory _taskFactory = new TaskFactory(); |
| | | private void LogHeightRawDataAsync(DateTime dt, double rawData, double compv, double final1, double final2, int stationNum) |
| | | private void LogHeightRawDataAsync(DateTime dt, double rawData, double compv, double final1, double final2, int slotNum) |
| | | { |
| | | _taskFactory.StartNew(new Action(() => |
| | | { |
| | |
| | | { |
| | | if (!isFileExisted) |
| | | { |
| | | writer.WriteLine("Time,Station,Height,CompZ,Final1,Final2"); |
| | | writer.WriteLine("Time,Slot,Height,CompZ,Final1,Final2"); |
| | | } |
| | | |
| | | writer.WriteLine($"{dt.ToString("HH:mm:ss.fff")},{stationNum},{rawData},{compv},{final1},{final2}"); |
| | | writer.WriteLine($"{dt.ToString("HH:mm:ss.fff")},{slotNum},{rawData},{compv},{final1},{final2}"); |
| | | writer.Flush(); |
| | | writer.Close(); |
| | | } |
| | |
| | | double errorBand = Convert.ToDouble(ConfigurationManager.AppSettings["ErrorBand"]); |
| | | bool isEnableRawData = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableRawData"]); |
| | | |
| | | private double HeightCompensation(double rawData, double compv, int stationNum) |
| | | private double HeightCompensation(double rawData, double compv, int slotNum) |
| | | { |
| | | double adjustValue, finalHeight, fakeValue; |
| | | adjustValue = rawData + compv; |
| | |
| | | |
| | | if (isEnableRawData) |
| | | { |
| | | LogHeightRawDataAsync(DateTime.Now, rawData, compv, finalHeight, fakeValue, stationNum); |
| | | LogHeightRawDataAsync(DateTime.Now, rawData, compv, finalHeight, fakeValue, slotNum); |
| | | } |
| | | |
| | | return fakeValue; |