public GeneralSBJControllerSettings (double bias, bool acBias, double range, bool isAutoRangeOn,double biasError, string gain, double triggerVoltage,
                              double triggerConductance, int sampleRate,
                              int totalSamples, int pretriggerSamples,
                              int stepperWaitTime1, int stepperWaitTime2, bool isFileSavingRequired, 
                              bool useKeithley, bool changeGain, string path, int currentFileNumber, int totalNUmberOfCycles,
                              double shourtCircuitVoltage, double openCircuitVoltage, bool useDefaultGain, 
                              bool useShortCircuitDelayTime, int shortCircuitDelayTime,
                              RunDirection runDirection, Sample bottom, Sample top)
 {
     Bias = bias;
     ACBias = acBias;
     Range = range;
     AutoRange = isAutoRangeOn;
     BiasError = biasError;
     Gain = gain;
     TriggerConductance = triggerConductance;
     TriggerVoltage = triggerVoltage;
     SampleRate = sampleRate;
     TotalSamples = totalSamples;
     PretriggerSamples = pretriggerSamples;
     StepperWaitTime1 = stepperWaitTime1;
     StepperWaitTime2 = stepperWaitTime2;
     IsFileSavingRequired = isFileSavingRequired;
     UseKeithley = useKeithley;
     ChangeGain = changeGain;
     UseShortCircuitDelayTime = useShortCircuitDelayTime;
     ShortCircuitDelayTime = shortCircuitDelayTime;
     Path = path;
     CurrentFileNumber = currentFileNumber;
     TotalNumberOfCycles = totalNUmberOfCycles;
     ShortCircuitVoltage = shourtCircuitVoltage;
     OpenCircuitVoltage = openCircuitVoltage;
     UseDefaultGain = useDefaultGain;
     RunDirection = runDirection;
     Bottom = bottom;
     Top = top;
 }
 public IVGeneralSettings (double voltageAmplitude, int samplesPerCycle, 
                              double outputUpdateDelay, int outputUpdateRate, 
                              double voltageForDisplayedTrace, double timeForOneIVCycle,
                              string gain, double triggerVoltage,
                              double triggerConductance, int sampleRate, bool isFileSavingRequired, 
                              string path, int currentFileNumber, int totalNUmberOfCycles,
                              double shortCircuitVoltage, Sample bottom, Sample top, bool useShortCircuitDelayTime,
                              int shortCircuitDelayTime)
 {
     VoltageAmplitude = voltageAmplitude;
     SamplesPerCycle = samplesPerCycle;
     OutputUpdateDelay = outputUpdateDelay;
     OutputUpdateRate = outputUpdateRate;
     VoltageForDisplayedTrace = voltageForDisplayedTrace;
     TimeForOneIVCycle = timeForOneIVCycle;
     Gain = gain;
     TriggerConductance = triggerConductance;
     TriggerVoltage = triggerVoltage;
     SampleRate = sampleRate;
     IsFileSavingRequired = isFileSavingRequired;
     Path = path;
     CurrentFileNumber = currentFileNumber;
     TotalNumberOfCycles = totalNUmberOfCycles;
     ShortCircuitVoltage = shortCircuitVoltage;
     Bottom = bottom;
     Top = top;
     UseShortCircuitDelayTime = useShortCircuitDelayTime;
     ShortCircuitDelayTime = shortCircuitDelayTime;
 }
Esempio n. 3
0
        /// <summary>
        /// Save sample's data to log book
        /// </summary>
        /// <param name="bottom">The bottom data</param>
        /// <param name="top">The top data</param>
        public void WriteToSamplesLog(Sample bottom, Sample top)
        {
            //
            // Try and open excel file
            //
            Application xlsLogBook = new Application();
            if (xlsLogBook == null)
            {
                throw new SBJException("Excel is not installed on current machine.");
            }

            //
            // Get the excel file from the settings file
            //
            string logBookPath = Settings.Default.SamplesLogBookPath;
            if (!File.Exists(logBookPath))
            {
                throw new SBJException(string.Format("Can't find sample's logbook on path: {0}.", logBookPath));
            }

            //
            // Open the first workbook and sheet
            // 
            Workbook workbook = xlsLogBook.Workbooks.Open(logBookPath,  Type.Missing,
                                                          false, Type.Missing,
                                                          Type.Missing, Type.Missing,
                                                          Type.Missing, Type.Missing,
                                                          Type.Missing, Type.Missing,
                                                          Type.Missing, Type.Missing,
                                                          Type.Missing, Type.Missing,
                                                          Type.Missing);
            Worksheet worksheet = workbook.ActiveSheet as Worksheet;

            //
            // Find the first empty row that is free for editing
            //
            int lastUsedRow = worksheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing).Row;
            int freeRow = lastUsedRow + 1;

            //
            // Write the data
            //
            worksheet.Cells[freeRow, 1] = DateTime.Now.ToShortDateString();
            worksheet.Cells[freeRow, 2] = bottom.ID;
            worksheet.Cells[freeRow, 3] = bottom.FirstLayerMetal.ToString();
            worksheet.Cells[freeRow, 4] = bottom.FirstLayerThickness;
            worksheet.Cells[freeRow, 5] = bottom.SecondLayerMetal.ToString();
            worksheet.Cells[freeRow, 6] = bottom.SecondLayerThickness;
            worksheet.Cells[freeRow, 7] = bottom.ElectrodeWidth;
            worksheet.Cells[freeRow, 8] = bottom.Molecule;
            worksheet.Cells[freeRow, 9] = bottom.Solvent;
            worksheet.Cells[freeRow, 10] = bottom.Dry;
            worksheet.Cells[freeRow, 11] = bottom.Piranha;
            worksheet.Cells[freeRow, 12] = bottom.Refabricated;
            worksheet.Cells[freeRow, 13] = bottom.Comments;

            //
            // Now write the top data
            //
            worksheet.Cells[freeRow, 14] = top.ID;
            worksheet.Cells[freeRow, 15] = top.FirstLayerMetal.ToString();
            worksheet.Cells[freeRow, 16] = top.FirstLayerThickness;
            worksheet.Cells[freeRow, 17] = top.SecondLayerMetal.ToString();
            worksheet.Cells[freeRow, 18] = top.SecondLayerThickness;
            worksheet.Cells[freeRow, 19] = top.ElectrodeWidth;
            worksheet.Cells[freeRow, 20] = top.Molecule;
            worksheet.Cells[freeRow, 21] = top.Solvent;
            worksheet.Cells[freeRow, 22] = top.Dry;
            worksheet.Cells[freeRow, 23] = top.Piranha;
            worksheet.Cells[freeRow, 24] = top.Refabricated;
            worksheet.Cells[freeRow, 25] = top.Comments;

            //
            // Use this code to save the file for the forst time.
            //
            //workbook.SaveAs(logBookPath, 51, null, null, null, null, XlSaveAsAccessMode.xlNoChange, null, null, null, null, null);

            //
            // Save and exit. Free resources as this is a COM object and we don't want the excel.exe process to hang.
            //
            workbook.Save();
            workbook.Close(true, Type.Missing, Type.Missing);            
            xlsLogBook.Quit();
            Marshal.ReleaseComObject(workbook);
            Marshal.ReleaseComObject(worksheet);
            Marshal.ReleaseComObject(xlsLogBook);
        }