public void Load(int recNo)
        {
            CalibratorDataSet set = CalibratorSet;
            Dictionary <int, CalibratorRow> allRows =
                Resource.Server.Devices.Calibrators.Category["All"];

            try
            {
                set.Select(recNo);

                if (set.GetRowCount() > 0)
                {
                    set.Fetch();

                    CalibratorRowDataSet rowSet = CalibratorRowSet;
                    rowSet.Select(set.RecNo);

                    for (int i = 0; i < rowSet.GetRowCount(); i++)
                    {
                        rowSet.Fetch(i);
                        CalibratorRow row = null;

                        if (allRows.TryGetValue(rowSet.Channel, out row) == true)
                        {
                            row.No = rowSet.Channel;
                            row.Calibrator.Active = true;
                            row.Calibrator.RawA   = rowSet.RawA;
                            row.Calibrator.RawB   = rowSet.RawB;
                            row.Calibrator.RawC   = rowSet.RawC;
                            row.Calibrator.DiffA  = rowSet.DiffA;
                            row.Calibrator.DiffB  = rowSet.DiffB;
                            row.Calibrator.DiffC  = rowSet.DiffC;

                            CalibPointDataSet pointSet = CalibPointSet;
                            pointSet.Select(rowSet.RecNo);

                            for (int j = 0; j < pointSet.GetRowCount(); j++)
                            {
                                pointSet.Fetch(j);

                                row.Calibrator.Points[j].PV = (float)pointSet.PV;
                                row.Calibrator.Points[j].SV = (float)pointSet.SV;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                throw new Exception("Occurred loading error of calibrator in UlFirebird.Load");
            }
        }
Example #2
0
        public void Calibrate()
        {
            for (int i = 0; i < channelGridView.RowCount; i++)
            {
                CalibratorRow row = channelGridView.GetRow(i) as CalibratorRow;

                if (row.Checked == true)
                {
                    row.Calibrator.CurveFit(Length);
                }
            }
        }
Example #3
0
        private void Initialize()
        {
            Category.Add("All", new Dictionary <int, CalibratorRow>());

            int    i     = 1;
            string key   = $"Item{i}";
            string value = Ini.GetString("All", key);

            while (value != "")
            {
                Category.Add(value, new Dictionary <int, CalibratorRow>());

                i++;
                key   = $"Item{i}";
                value = Ini.GetString("All", key);
            }

            Dictionary <int, CalibratorRow> rows    = null;
            Dictionary <int, CalibratorRow> allRows = null;

            foreach (KeyValuePair <string, Dictionary <int, CalibratorRow> > calRow in Category)
            {
                if (calRow.Key == "All")
                {
                    allRows = calRow.Value;
                    allRows.Clear();
                }
                else
                {
                    rows = calRow.Value;
                    rows.Clear();

                    i     = 1;
                    key   = $"Item{i}";
                    value = Ini.GetString(calRow.Key, key);

                    while (value != "")
                    {
                        string[]      keys = value.Split(new[] { ',' }, StringSplitOptions.None);
                        CalibratorRow row  = new CalibratorRow(int.Parse(keys[1]), keys[0]);

                        rows.Add(row.No, row);
                        allRows.Add(row.No, row);

                        i++;
                        key   = $"Item{i}";
                        value = Ini.GetString(calRow.Key, key);
                    }
                }
            }
        }
Example #4
0
        private bool IsAllCheckFalse(BandedGridView view)
        {
            bool ret = true;

            for (int i = 0; i < channelGridView.RowCount; i++)
            {
                CalibratorRow row = channelGridView.GetRow(i) as CalibratorRow;

                if (row.Checked == true)
                {
                    ret = false;
                    break;
                }
            }

            return(ret);
        }
Example #5
0
        public void SetRawRealValue()
        {
            channelGridView.BeginDataUpdate();

            try
            {
                for (int i = 0; i < channelGridView.RowCount; i++)
                {
                    CalibratorRow row = channelGridView.GetRow(i) as CalibratorRow;

                    row.Raw  = Resource.Server.Devices.GetRecorderRawValue(row.No);
                    row.Real = Resource.Server.Devices.GetRecorderRealValue(row.No);
                }

                OnRefreshView(channelGrid, null);
            }
            finally
            {
                channelGridView.EndDataUpdate();
            }
        }
Example #6
0
        public void SetValuePV()
        {
            channelGridView.BeginDataUpdate();

            try
            {
                for (int i = 0; i < channelGridView.RowCount; i++)
                {
                    CalibratorRow row = channelGridView.GetRow(i) as CalibratorRow;

                    if (row.Checked == true)
                    {
                        row.Calibrator.Points[Index].PV = Resource.Server.Devices.GetRecorderRawValue(row.No);
                    }
                }

                OnRefreshView(channelGrid, null);
            }
            finally
            {
                channelGridView.EndDataUpdate();
            }
        }
Example #7
0
        public void SetValueSV(float value)
        {
            channelGridView.BeginDataUpdate();

            try
            {
                for (int i = 0; i < channelGridView.RowCount; i++)
                {
                    CalibratorRow row = channelGridView.GetRow(i) as CalibratorRow;

                    if (row.Checked == true)
                    {
                        row.Calibrator.Points[Index].SV = value;
                    }
                }

                OnRefreshView(channelGrid, null);
            }
            finally
            {
                channelGridView.EndDataUpdate();
            }
        }