Пример #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));
            }
        }
Пример #2
0
        /// <summary>
        /// Передать данные серверу данных данные АСУ
        /// </summary>
        protected void UpdateDevManData()
        {
            try
            {
                Parameter[] updated = { commutator.Speed_1,      commutator.Speed_2,      commutator.Speed_rotor,
                                        commutator.Torque_rotor, commutator.Wedges_state, commutator.Force,
                                        commutator.Diameter_1,   commutator.Diameter_2,   commutator.CodeButton };

                if (updated != null)
                {
                    foreach (Parameter p_updated in updated)
                    {
                        if (p_updated != null)
                        {
                            PDescription channel = p_updated.Channel;
                            if (channel != null)
                            {
                                DevManClient.UpdateParameter(channel.Number, p_updated.CurrentValue);
                            }
                        }
                    }
                }
            }
            catch { }
        }
Пример #3
0
 /// <summary>
 /// проверить состояние сервера WCF
 /// </summary>
 public void PingWcf()
 {
     try
     {
         DevManClient.UpdateParameter(-1, float.NaN);
     }
     catch (Exception ex)
     {
         ErrorHandler.WriteToLog(null, new ErrorArgs(ex.Message, ErrorType.Unknown));
     }
 }
Пример #4
0
        /// <summary>
        /// наладческая прижмочка выполнила
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tech_onJop(object sender, EventArgs e)
        {
            try
            {
                /*DevManClient.UpdateParameter(tech.Consumption.IndexToSave, tech.Consumption.Value);
                 * DevManClient.UpdateParameter(tech.Volume.IndexToSave, tech.Volume.Value);*/

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

                foreach (Rgr rgr in tech.Rgrs)
                {
                    DevManClient.UpdateParameter(rgr.Consumption.IndexToSave, rgr.Consumption.Value);
                    DevManClient.UpdateParameter(rgr.Volume.IndexToSave, rgr.Volume.Value);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteToLog(sender, new ErrorArgs(ex.Message, ErrorType.NotFatal));
            }
        }
Пример #5
0
        /// <summary>
        /// Передать технологически параметры серверу данных
        /// </summary>
        protected void UpdateTechnologyParameters()
        {
            try
            {
                TParameter[] t_prms = SgtApplication.CreateInstance().Technology.Parameters;
                if (t_prms != null)
                {
                    foreach (TParameter parameter in t_prms)
                    {
                        if (parameter != null && parameter.IsSimple == false)
                        {
                            int dev_number = NumberTechOnDev(parameter.SNumber);
                            if (dev_number != -1)
                            {
                                DevManClient.UpdateParameter(dev_number, parameter.Value);
                            }
                        }
                        else
                        if (parameter != null && parameter.IsSimple == true)
                        {
                            switch (parameter.UnigueClassName)
                            {
                            case "P0014":

                                try
                                {
                                    P0014 par = parameter as P0014;
                                    if (par != null && par.Source == P0014Source.Own)
                                    {
                                        int dev_number = NumberTechOnDev(par.SNumber);
                                        if (dev_number != -1)
                                        {
                                            DevManClient.UpdateParameter(dev_number, parameter.Value);
                                        }
                                    }
                                }
                                catch { }
                                break;

                            case "P14_1":

                                try
                                {
                                    P14_1 par = parameter as P14_1;
                                    if (par != null && par.Source == P0014Source.Own)
                                    {
                                        int dev_number = NumberTechOnDev(par.SNumber);
                                        if (dev_number != -1)
                                        {
                                            DevManClient.UpdateParameter(dev_number, parameter.Value);
                                        }
                                    }
                                }
                                catch { }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteToLog(this, new ErrorArgs(ex.Message, ErrorType.NotFatal));
            }
        }