public static double ConvertToGs(this int value, InformationHolder.GainType gain) { // ADC Value var vADC = AppSettings.LSBValue * value; // gF Value double gfValue = double.MinValue; switch (gain) { case InformationHolder.GainType.HighGain: gfValue = AppSettings.HighGain; break; default: // Default case should never be hit throw new ArgumentNullException(); case InformationHolder.GainType.LowGain: gfValue = AppSettings.LowGain; break; } // VSensor var vSensor = vADC / gfValue / (AppSettings.SensorCapacitance / AppSettings.FeedbackCapacitance); // gADC //var gADC = vSensor / AppSettings.SensorSensitivity; var gADC = vSensor; return gADC; }
public static InformationHolder LowGainContainer() { if (lowGainSingleton == null) { lowGainSingleton = new InformationHolder(); lowGainSingleton.Gain = GainType.LowGain; } return lowGainSingleton; }
private void saveFile(List<int> data, String filename, InformationHolder.GainType gain) { DockingAnalytics._xmlFile myFile = new DockingAnalytics._xmlFile(filename); ArrayList zedDataArrayList = new ArrayList(); // TODO: For now, this is only adding the data that was collected by the recording to the file. // This will break existing expected functionality with existing graph saves (They are expected to // save all data points that are currently graphed). // Probable solution: Separate save method for a graph without recorded data, and one for a graph with recorded data foreach (int datapoint in data) { double val = datapoint.ConvertToGs(gain); zedDataArrayList.Add(val); } //for (int i = 0; i < gp.ZedGraphControl.GraphPane.CurveList[Controller.graphCurveListIndex].Points.Count; i++) //{ // zedDataArrayList.Add(gp.ZedGraphControl.GraphPane.CurveList[Controller.graphCurveListIndex].Points[i].Y); //} myFile.AddAccelerationValues(zedDataArrayList); myFile.dsSentry_data.sampling_Freq = DockingAnalytics.GlobalVars.AccelFreq; ; //myFile.dsSentry_data.accel_Vg_Calibration = DockingAnalytics.GlobalVars.AccelYScale; myFile.dsSentry_data.offset_Calibration = 1; //myFile.dsSentry_data.max_Freq_Res = DockingAnalytics.GlobalVars.MaxResFreq; //myFile.dsSentry_data.settings_Timestamp_Created = tss; //myFile.dsSentry_data.settings_Timestamp_LastEdit = DateTime.Now; //USB ADC Capture Write myFile.dsSentry_data.capture_type = "Manual"; //myFile.dsSentry_data.node_Serial = GetAlphaNum(); myFile.dsSentry_data.node_Serial = "12345"; //myFile.dsSentry_data.gateway_Serial = GetAlphaNum(); myFile.dsSentry_data.manufacturer_Name = "ADVIS"; myFile.dsSentry_data.owner_Name = "Company ABC"; myFile.dsSentry_data.location_Name_1 = "Factory A"; //myFile.dsSentry_data.timestamp_Start = tss; myFile.dsSentry_data.timestamp_End = DateTime.Now; myFile.XmlWrite(); }
public static InformationHolder HighGainContainer() { if (highGainSingleton == null) { highGainSingleton = new InformationHolder(); highGainSingleton.Gain = GainType.HighGain; } return highGainSingleton; }