Ejemplo n.º 1
0
        /// <summary>
        /// технологическая примочка выполнила вычисления
        /// </summary>
        /// <param name="sender">Источник события</param>
        /// <param name="e">Параметры события</param>
        protected void tech_onCalculate(object sender, EventArgs e)
        {
            try
            {
                TechStage current = tech.Stages.Current;
                if (current != null)
                {
                    /*DevManClient.UpdateParameter(tech.Consumption.IndexToSave, current.Consumption);
                     * DevManClient.UpdateParameter(tech.Volume.IndexToSave, current.Volume);*/
                    DevManClient.UpdateParameter(tech.ProccessVolume.IndexToSave, tech.Stages.ProccessVolume);

                    // ----------- тестовое -----------

                    foreach (Rgr rgr in tech.Rgrs)
                    {
                        DevManClient.UpdateParameter(rgr.Consumption.IndexToSave, rgr.CurrentConsumption);
                        DevManClient.UpdateParameter(rgr.Volume.IndexToSave, rgr.CurrentVolume);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteToLog(sender, new ErrorArgs(ex.Message, ErrorType.NotFatal));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Обновить поправочный коэффициент
        /// </summary>
        public void UpdateKoef(float nKoef)
        {
            try
            {
                //DevManClient.SendToCom(string.Empty);
                TechStage st = Current;

                if (st != null)
                {
                    if (st.StateRGR == StateRGR.Pressed)
                    {
                        if (st.Block(300))
                        {
                            w  = _tech.Volume.Value;
                            w0 = st.ConstVolume;

                            s = (w - w0) * constKoef + s;

                            st.ConstVolume = w;
                            st.Release();
                        }
                    }
                }
                constKoef = nKoef;
            }
            catch { }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Запустили РГР
        /// </summary>
        public void RgrOn()
        {
            TechStage st = Current;

            if (st != null)
            {
                st.RecordRGR();
                rgrOn = DateTime.Now;

                w0 = st.Volume;
            }
        }
Ejemplo n.º 4
0
        // --------------- методы управления этапами ---------------

        /// <summary>
        /// новый этап работы
        /// </summary>
        public void NextStage()
        {
            if (isfinished)
            {
                stages.Clear();
                isfinished = false;
            }

            int       number  = 0;
            TechStage current = Current;

            if (current != null)
            {
                Current.FinishStage();
                number = current.Number;
            }

            if (slim.TryEnterWriteLock(500))
            {
                try
                {
                    TechStage stage = new TechStage(_tech);
                    stage.Number = number + 1;

                    if (current != null && current.StateRGR == StateRGR.Pressed)
                    {
                        stage.RecordRGR();
                    }

                    stages.Add(stage);
                    stage.StartStage();

                    s = 0;
                }
                finally
                {
                    slim.ExitWriteLock();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Загрузить этапы
        /// </summary>
        /// <param name="root">Узел в котором искать параметры СКПБ</param>
        public void Deserialize(XmlNode root)
        {
            try
            {
                if (root != null)
                {
                    if (root != null && root.Name == rootName)
                    {
                        XmlNodeList childs = root.ChildNodes;
                        if (childs != null)
                        {
                            foreach (XmlNode child in childs)
                            {
                                switch (child.Name)
                                {
                                case rootRGROn:

                                    try
                                    {
                                        rgrOn = DateTime.Parse(child.InnerText);
                                    }
                                    catch { }
                                    break;

                                case constCoefName:

                                    try
                                    {
                                        constKoef = float.Parse(child.InnerText);
                                    }
                                    catch { }
                                    break;

                                case "shift":

                                    try
                                    {
                                        s = float.Parse(child.InnerText);
                                    }
                                    catch { }
                                    break;

                                case "stage":

                                    try
                                    {
                                        TechStage stage = new TechStage(_tech);
                                        stage.Deserialize(child);

                                        stages.Add(stage);
                                    }
                                    catch { }
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch { }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Выполнить копирование с учетеом технологии
        /// </summary>
        private void BackingUpDataTech(Parameter[] parameters)
        {
            if (parameters != null)
            {
                // ----------- копируем значения каналов в технологическую примочку ---------------

                if (tech_consumption.Index >= 0 && tech_consumption.Index < parameters.Length)
                {
                    float Val = parameters[tech_consumption.Index].CurrentValue;
                    if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                        !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                    {
                        tech_consumption.Value          = Val;
                        tech_consumption.FormattedValue = string.Format(tech_consumption.Format, Val);
                    }
                    else
                    {
                        tech_consumption.FormattedValue = "-----";
                    }
                }

                if (tech_volume.Index >= 0 && tech_volume.Index < parameters.Length)
                {
                    float Val = parameters[tech_volume.Index].CurrentValue;
                    if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                        !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                    {
                        tech_volume.Value          = Val;
                        tech_volume.FormattedValue = string.Format(tech_volume.Format, Val);
                    }
                    else
                    {
                        tech_volume.FormattedValue = "-----";
                    }
                }

                if (tech_density.Index >= 0 && tech_density.Index < parameters.Length)
                {
                    float Val = parameters[tech_density.Index].CurrentValue;
                    if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                        !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                    {
                        tech_density.Value          = Val;
                        tech_density.FormattedValue = string.Format(tech_density.Format, Val);
                    }
                    else
                    {
                        tech_density.FormattedValue = "-----";
                    }
                }

                if (tech_pressure.Index >= 0 && tech_pressure.Index < parameters.Length)
                {
                    float Val = parameters[tech_pressure.Index].CurrentValue;
                    if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                        !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                    {
                        tech_pressure.Value          = Val;
                        tech_pressure.FormattedValue = string.Format(tech_pressure.Format, Val);
                    }
                    else
                    {
                        tech_pressure.FormattedValue = "-----";
                    }
                }

                if (tech_temperature.Index >= 0 && tech_temperature.Index < parameters.Length)
                {
                    float Val = parameters[tech_temperature.Index].CurrentValue;
                    if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                        !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                    {
                        tech_temperature.Value          = Val;
                        tech_temperature.FormattedValue = string.Format(tech_temperature.Format, Val);
                    }
                    else
                    {
                        tech_temperature.FormattedValue = "-----";
                    }
                }

                // ---------- тестовое ----------

                foreach (Rgr rgr in rgrs)
                {
                    if (rgr.Volume.Index >= 0 && rgr.Volume.Index < parameters.Length)
                    {
                        float Val = parameters[rgr.Volume.Index].CurrentValue;
                        if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                            !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                        {
                            rgr.Volume.Value = Val;
                        }
                    }

                    if (rgr.Consumption.Index >= 0 && rgr.Consumption.Index < parameters.Length)
                    {
                        float Val = parameters[rgr.Consumption.Index].CurrentValue;
                        if (!float.IsNaN(Val) && !float.IsInfinity(Val) &&
                            !float.IsNegativeInfinity(Val) && !float.IsPositiveInfinity(Val))
                        {
                            rgr.Consumption.Value = Val;
                        }
                    }
                }

                // ---------------------------------------------------------------------------------

                TechStage current = Stages.Current;
                if (current != null)
                {
                    is_finished = true;
                    current.Calculate(rgrs);
                    //rgr.Calculate(stages.CorrectionFactor, current.StateRGR);

                    if (onCalculate != null)
                    {
                        onCalculate(this, EventArgs.Empty);
                    }
                }
                else
                {
                    if (!is_finished)
                    {
                        if (onJop != null)
                        {
                            onJop(this, EventArgs.Empty);
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        // --------------- методы управления этапами ---------------
        /// <summary>
        /// новый этап работы
        /// </summary>
        public void NextStage()
        {
            if (isfinished)
            {
                stages.Clear();
                isfinished = false;
            }

            int number = 0;
            TechStage current = Current;

            if (current != null)
            {
                Current.FinishStage();
                number = current.Number;
            }

            if (slim.TryEnterWriteLock(500))
            {
                try
                {
                    TechStage stage = new TechStage(_tech);
                    stage.Number = number + 1;

                    if (current != null && current.StateRGR == StateRGR.Pressed)
                    {
                        stage.RecordRGR();
                    }

                    stages.Add(stage);
                    stage.StartStage();

                    s = 0;
                }
                finally
                {
                    slim.ExitWriteLock();
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Загрузить этапы
        /// </summary>
        /// <param name="root">Узел в котором искать параметры СКПБ</param>
        public void Deserialize(XmlNode root)
        {
            try
            {
                if (root != null)
                {
                    if (root != null && root.Name == rootName)
                    {
                        XmlNodeList childs = root.ChildNodes;
                        if (childs != null)
                        {
                            foreach (XmlNode child in childs)
                            {
                                switch (child.Name)
                                {
                                    case rootRGROn:

                                        try
                                        {
                                            rgrOn = DateTime.Parse(child.InnerText);
                                        }
                                        catch { }
                                        break;

                                    case constCoefName:

                                        try
                                        {
                                            constKoef = float.Parse(child.InnerText);
                                        }
                                        catch { }
                                        break;

                                    case "shift":

                                        try
                                        {
                                            s = float.Parse(child.InnerText);
                                        }
                                        catch { }
                                        break;

                                    case "stage":

                                        try
                                        {
                                            TechStage stage = new TechStage(_tech);
                                            stage.Deserialize(child);

                                            stages.Add(stage);
                                        }
                                        catch { }
                                        break;

                                    default:
                                        break;
                                }
                            }
                        }
                    }
                }
            }
            catch { }
        }