Example #1
0
        private Transformation transformation;          // реализует калибровку значения параметра

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        public Parameter(int i_index)
        {
            slim   = new ReaderWriterLockSlim();
            c_slim = new ReaderWriterLockSlim();

            v_slim = new ReaderWriterLockSlim();

            name        = "Параметр не определен";
            description = "-----";

            range          = new ParameterRange();
            intervalToSave = 500;

            selfIndex = i_index;

            guid    = Guid.NewGuid();
            db_time = DateTime.MinValue;

            transformation = new Transformation();

            Transformation.TCondition t1 = new Transformation.TCondition();
            Transformation.TCondition t2 = new Transformation.TCondition();

            t1.Result = 0;
            t1.Signal = 0;

            t2.Result = 65535;
            t2.Signal = 65535;

            transformation.Insert(t1);
            transformation.Insert(t2);
        }
Example #2
0
        private Parameter _parameter; // калибруемый параметр

        #endregion Fields

        #region Constructors

        public AddTransformationForm(SGT.SgtApplication _app)
        {
            app = _app;
            app.Commutator.onUpdated +=new CommutatorEventHandler(Converter_OnComplete);

            InitializeComponent();

            transformation = new Transformation();

            transformation.OnInsert += new Transformation.TConditionEventHandle(transformation_OnInsert);
            transformation.OnEdit += new Transformation.TConditionEventHandle(transformation_OnEdit);
            transformation.OnRemove += new Transformation.TConditionEventHandle(transformation_OnRemove);

            transformation.OnClear += new EventHandler(transformation_OnClear);
            transformation.OnError += new Transformation.ErrorEventHandle(transformation_OnError);

            transformation.OnExist += new Transformation.TConditionEventHandle(transformation_OnExist);

            Transformation.TCondition t1 = new Transformation.TCondition();
            Transformation.TCondition t2 = new Transformation.TCondition();

            t1.Result = 0;
            t1.Signal = 0;

            t2.Result = 65535;
            t2.Signal = 65535;

            transformation.Insert(t1);
            transformation.Insert(t2);

            first = new Argument();
            second = new Argument();

            calibrationGraphic.CalculateScale();
            t_inserter = new InsertToText(InserterText);

            /*
            media = new Media();

            media.Args[0].Index = 0;
            media.Args[1].Index = 1;

            med = new Float[2];
            for (int i = 0; i < med.Length; i++)
            {
                med[i] = new Float();
            }
             */
        }
Example #3
0
        /// <summary>
        /// Выбрать калибруемый параметр
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void selectParameter_Click(object sender, EventArgs e)
        {
            ResultsForm r_frm = new ResultsForm(app);
            if (_parameter != null)
            {
                r_frm.Position = _parameter.Identifier;
            }

            if (r_frm.ShowDialog(this) == DialogResult.OK)
            {
                textBoxSelectedParameter.Tag = r_frm.SelectedParameter;
                textBoxSelectedParameter.Text = r_frm.SelectedParameter.Name;

                _parameter = r_frm.SelectedParameter;
                checkBoxDoScale.Checked = false;

                transformation.Clear();
                foreach (Transformation.TCondition val in _parameter.Transformation.Table)
                {
                    Transformation.TCondition _v = new Transformation.TCondition();

                    _v.Multy = val.Multy;
                    _v.Result = val.Result;

                    _v.Shift = val.Shift;
                    _v.Signal = val.Signal;

                    transformation.Insert(_v);
                }
                //transformation.Arg[0].Index = first.Index;
            }
        }
Example #4
0
        /// <summary>
        /// Добавляем точку
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void insertPoint_Click(object sender, EventArgs e)
        {
            try
            {
                Transformation.TCondition t_condition = new Transformation.TCondition();

                t_condition.Signal = double.Parse(textBoxTotablePhysic.Text);
                t_condition.Result = double.Parse(textBoxToTableCalibrated.Text);

                transformation.Insert(t_condition);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                checkBoxDoScale.Checked = false;

                transformation.Clear();

                Transformation.TCondition t1 = new Transformation.TCondition();
                Transformation.TCondition t2 = new Transformation.TCondition();

                t1.Result = 0;
                t1.Signal = 0;

                t2.Result = 65535;
                t2.Signal = 65535;

                transformation.Insert(t1);
                transformation.Insert(t2);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }