Esempio n. 1
0
        public MainForm()
        {
            InitializeComponent();
            peekPress.Start();
            _db = new Database(Properties.Settings.Default.DEFAULT_DB_PATH);

            foreach (Reading r in _db.GetReadings())
            {
                _listReadings.Items.Add(r);
            }

            ZedGraph.GraphPane pane = graphTrans.GraphPane;
            pane.Title.Text = "Transducer";
            pane.XAxis.Title.Text = " Time (ms) ";
            pane.YAxis.Title.Text = " Pressure (psi) ";
            pane.YAxis.Scale.Max = 1000;
            pane.YAxis.Scale.Min = 0;
        }
Esempio n. 2
0
        public void TestRetrieval()
        {
            using (Database db = new Database(DB_TEST))
            {
                db.EmptyDatabase();
                Reading r = db.CreateReading("TEST", "DESC");
                ChannelConfig cc = db.CreateChannelConfig("Config1", 1000, OutputVoltRange.ZeroToFiveVolts, 0, 1);
                DAQChannel ch1 = db.CreateChannelForReading(r,cc, "DAQChannel 1", 1);
                ReadingDetail rd1 = db.CreateDetailForChannelandReading(ch1, 1, 100);
                ReadingDetail rd2 = db.CreateDetailForChannelandReading(ch1, 2, 200);
                ReadingDetail rd3 = db.CreateDetailForChannelandReading(ch1, 3, 300);
                DAQChannel ch2 = db.CreateChannelForReading(r,cc, "DAQChannel 2", 2);
                ReadingDetail rd4 = db.CreateDetailForChannelandReading(ch2, 1, 400);
                ReadingDetail rd5 = db.CreateDetailForChannelandReading(ch2, 2, 500);
                ReadingDetail rd6 = db.CreateDetailForChannelandReading(ch2, 3, 600);

                Reading[] readers = db.GetReadings();
                foreach (Reading testReading in readers)
                {
                    Assert.IsTrue(testReading.ID == r.ID);

                    DAQChannel testChannel1 = testReading.GetChannelAtNumber(1);
                    Assert.IsTrue(testChannel1.ID == ch1.ID);
                    Assert.IsTrue(testChannel1.Config.ID == cc.ID);
                    Assert.IsTrue(testChannel1.ReadingDetails.Count == 3);
                    Assert.IsTrue(testChannel1.ReadingDetails[0].ID == rd1.ID);
                    Assert.IsTrue(testChannel1.ReadingDetails[1].ID == rd2.ID);
                    Assert.IsTrue(testChannel1.ReadingDetails[2].ID == rd3.ID);

                    DAQChannel testChannel2 = testReading.GetChannelAtNumber(2);
                    Assert.IsTrue(testChannel2.ReadingDetails.Count == 3);
                    Assert.IsTrue(testChannel2.ID == ch2.ID);
                    Assert.IsTrue(testChannel2.Config.ID == cc.ID);
                    Assert.IsTrue(testChannel2.ReadingDetails[0].ID == rd4.ID);
                    Assert.IsTrue(testChannel2.ReadingDetails[1].ID == rd5.ID);
                    Assert.IsTrue(testChannel2.ReadingDetails[2].ID == rd6.ID);

                    DAQChannel testChannel3 = r.GetChannelAtNumber(3);
                    Assert.IsTrue(testChannel3 == null);
                }

                db.CloseDatabase();
            }
        }