コード例 #1
0
        private void GraphVoltages(TDK t)
        {
            Chart chart1 = new Chart();

            chart1.Series.Clear();
            var series = new Series("Volts");

            series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
            series.Enabled   = true;
            chart1.Series.Add(series);
            chart1.Visible = true;
            ChartArea chA = new ChartArea();

            chA.AxisX.RoundAxisValues();
            chA.AxisX.Title = "Cycle";
            chA.AxisY.Title = "Voltage";
            chart1.ChartAreas.Add(chA);
            var lin = Linespace(1, t.CycleCount, t.PastVoltages.Count - 2);
            var ii  = 0;

            foreach (var val in t.PastVoltages)
            {
                chart1.Series["Volts"].Points.AddXY(lin[ii], val);
                ii++;
            }
            chart1.Invalidate();

            chart1.SaveImage($"{_resultsDir}\\charts\\{t.SampleName}_C{t.CycleCount}.png", System.Drawing.Imaging.ImageFormat.Png);
        }
コード例 #2
0
        private void SetCurrentVoltage(TDK tdk)
        {
            // Sets the current limit of the power supply
            do
            {
                _serTDK.Write("PC " + tdk.SetCurrent + "\r\n");
                if (_serTDK.ReadLine() == "OK")
                {
                    U.Logger.WriteLine($"Current: OKAY");
                }
                _serTDK.Write("PC?\r\n");
            } while (_serTDK.ReadLine() == tdk.SetCurrent);

            do
            {
                //Sets the voltage of the power supply
                _serTDK.Write("PV " + U.VoltageCompliance + "\r\n");
                if (_serTDK.ReadLine() == "OK")
                {
                    U.Logger.WriteLine($"Voltage: OKAY");
                }
                _serTDK.Write("PC?\r\n");
            } while (_serTDK.ReadLine() == U.VoltageCompliance);
            _serTDK.DiscardInBuffer();
        }
コード例 #3
0
 private void SetAddress(TDK tdk)
 {
     // Sets the address of the power supply
     _serTDK.Write("ADR " + tdk.Address + "\r\n");
     if (_serTDK.ReadLine() == "OK")
     {
     }
 }
コード例 #4
0
        private void SaveResults(TDK t)
        {
            var str  = CompileDataStr(t);
            var path = _resultsDir + $"{t.SampleName}_{DateTime.Now:M-dd--HH-mm--ss}.txt";

            using (var writer = new StreamWriter(path, true)) {
                writer.WriteLine(str);
            }
        }
コード例 #5
0
        private void SaveResults(TDK t)
        {
            var str  = CompileDataStr(t);
            var path = _resultsDir + $"\\{t.SampleName}.txt";

            using (var writer = new StreamWriter(path, true)) {
                writer.WriteLine(str);
            }
        }
コード例 #6
0
 private CCDataPoint CompileCCData(TDK t)
 {
     return(new CCDataPoint(t.CycleCount,
                            (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds, // epoch
                            (_totalTimer.ElapsedMilliseconds / 3.6E+6),                // total time (hrs)
                            (_intoCycleTimer.ElapsedMilliseconds / 60000.0),           // time into current cycle
                            BIASON, t.SampleName, double.Parse(t.Current), double.Parse(t.Voltage), int.Parse(t.NumCells),
                            double.Parse(t.Voc), int.Parse(t.TempSensor), double.Parse(t.SetCurrent), -99.99,
                            _temps, _smokeRaw, _smokeLevel));
 }
コード例 #7
0
        private void TurnON(TDK tdk)
        {
            // Sets the address of the power supply
            SetAddress(tdk);

            do
            {
                _serTDK.Write("OUT ON\r\n");
                if (_serTDK.ReadLine() == "OK")
                {
                    Console.WriteLine($"ON: OKAY");
                }
                _serTDK.Write("MODE?\r\n");
            } while (_serTDK.ReadLine() == "ON");
        }
コード例 #8
0
        private void TurnON(TDK tdk)
        {
            // Sets the address of the power supply
            SetAddress(tdk);

            do
            {
                _serTDK.Write("OUT ON\r\n");
                if (_serTDK.ReadLine() == "OK")
                {
                    U.Logger.WriteLine($"ON: OKAY");
                }
                _serTDK.Write("MODE?\r\n");
            } while (_serTDK.ReadLine() == "ON");
            _serTDK.DiscardInBuffer();
        }
コード例 #9
0
 private string CompileDataStr(TDK t)
 {
     string[] str = { t.CycleCount.ToString(),                                    (DateTime.UtcNow - new DateTime(1970,                              1, 1)).TotalSeconds.ToString(),
                      (_totalTimer.ElapsedMilliseconds / 3.6E+6).ToString(),      // total time (hrs)
                      (_intoCycleTimer.ElapsedMilliseconds / 60000.0).ToString(),
                      (BIASON) ? "ON" : "OFF",
                      t.SampleName,                                               t.Current,                            t.Voltage,                      t.NumCells,                 t.Voc,
                      t.TempSensor,                                               t.SetCurrent,                         "",
                      $"{_temps[0].ToString("F1")}",                              $"{_temps[1].ToString("F1")}",        $"{_temps[2].ToString("F1")}",
                      $"{_temps[3].ToString("F1")}",                              $"{_temps[4].ToString("F1")}",        $"{_temps[5].ToString("F1")}",
                      $"{_temps[6].ToString("F1")}",                              $"{_temps[7].ToString("F1")}",        $"{_temps[8].ToString("F1")}",
                      $"{_temps[9].ToString("F1")}",                              $"{_temps[10].ToString("F1")}",       $"{_temps[11].ToString("F1")}",
                      $"{_temps[12].ToString("F1")}",                             $"{_temps[13].ToString("F1")}",       $"{_temps[14].ToString("F1")}",
                      $"{_temps[15].ToString("F1")}" };
     return(string.Join(",", str));
 }
コード例 #10
0
        private void SaveResultsBQ(TDK t)
        {
            var point = CompileCCData(t);

            CycleDataEvent?.Invoke(this, new DataQueueObject(DataQueueObject.DataType.CycleData, point));
        }