Пример #1
0
        /// <summary>
        /// 根据数据 提取特征值 存储
        /// </summary>
        /// <param name="model"></param>
        /// <param name="ms"></param>
        /// <param name="rev"></param>
        private void ExtractValue(DataTwModel model, MeterageSamplerate ms, int rev = -1)
        {
            List <MalfunctionSetting> settingList       = GetMalfunctionSettingList(ms, rev).OrderByDescending(m => m.TypeId).ToList();
            List <BandDiagnosis>      bandDiagnosisList = new List <BandDiagnosis>();
            FeatureExtraction         featureExtraction = new FeatureExtraction(model);

            foreach (MalfunctionSetting setting in settingList)
            {
                float value = featureExtraction.ComputedFeature(setting);
                Console.WriteLine($"{setting.TypeName}:{value}");
                BandDiagnosis bandDiagnosis = new BandDiagnosis()
                {
                    BdTime  = DateTime.Now,
                    BdType  = 1,
                    BdUnit  = "mm/s",
                    MsId    = setting.MsId,
                    BdValue = value
                };
                bandDiagnosisList.Add(bandDiagnosis);
                //报警状态设置
                DirverRelation dirverRelation = _dirverRelationList.FirstOrDefault(dr => dr.DId == setting.UnitId && dr.DType == setting.UnitType);
                if (dirverRelation == null)
                {
                    continue;
                }
                if (!_dirverRelationFirst.Keys.Contains(dirverRelation))
                {
                    _dirverRelationFirst.Add(dirverRelation, true);
                    dirverRelation.DrState = 1;
                }
                int level = 1;
                if (setting.Danger == 0)
                {
                    continue;
                }
                if (setting.Danger < value)
                {
                    level = 4;
                }
                else if (setting.Warning < value)
                {
                    level = 3;
                }
                else if (setting.EasyWarning < value)
                {
                    level = 2;
                }

                if (dirverRelation.DrState < level)
                {
                    dirverRelation.DrState = level;
                }
            }
            if (bandDiagnosisList.Count > 0)
            {
                _bandDiagnosisService.InsertEntityList(bandDiagnosisList);
            }
        }
Пример #2
0
        /// <summary>
        /// 获取特征值项
        /// </summary>
        /// <param name="dirver">元件关系</param>
        /// <param name="value">同类型元件集合</param>
        /// <param name="nType">元件类型</param>
        /// <param name="nDriverId">元件id</param>
        /// <param name="inRpm">元件输入转速</param>
        /// <returns></returns>
        public FeatureItem GetFeatureItem(DirverRelation dirver, object value, int nType, int nDriverId, int inRpm)
        {
            object obj = null;

            switch (nType)
            {
            case 1:     //电动机
                if (value is List <DirverMotor> )
                {
                    List <DirverMotor> motors = (List <DirverMotor>)value;
                    if (motors != null && motors.Count > 0)
                    {
                        //集合中查找对应的电机对象
                        obj = motors.Find(x => x.DmId == nDriverId);
                    }
                }
                break;

            case 2:
                if (value is List <DirverGear> )
                {
                    List <DirverGear> gearList = (List <DirverGear>)value;
                    if (gearList != null && gearList.Count > 0)
                    {
                        obj = gearList.Find(x => x.MId == nDriverId);
                    }
                }
                break;

            case 3:
                #region 风机
                if (value is List <DirverFan> )
                {
                    List <DirverFan> fanList = (List <DirverFan>)value;
                    if (fanList != null && fanList.Count > 0)
                    {
                        obj = fanList.Find(x => x.FId == nDriverId);
                    }
                }

                #endregion
                break;

            case 4:
                #region 泵
                if (value is List <DirverPump> )
                {
                    List <DirverPump> pumpList = (List <DirverPump>)value;
                    if (pumpList != null && pumpList.Count > 0)
                    {
                        obj = pumpList.Find(x => x.PId == nDriverId);
                    }
                }

                #endregion
                break;

            case 5:
                #region 皮带转动/风机
                if (value is List <DirverBelt> )
                {
                    List <DirverBelt> beltList = (List <DirverBelt>)value;
                    if (beltList != null && beltList.Count > 0)
                    {
                        obj = beltList.Find(x => x.BId == nDriverId);
                    }
                }

                #endregion
                break;

            case 6:
                #region 变比机构
                if (value is List <DirverShifting> )
                {
                    List <DirverShifting> shiftingList = (List <DirverShifting>)value;
                    if (shiftingList != null && shiftingList.Count > 0)
                    {
                        obj = shiftingList.Find(x => x.DsId == nDriverId);
                    }
                }

                #endregion
                break;

            case 7:
                #region 线速度
                if (value is List <DirverLinerspeed> )
                {
                    List <DirverLinerspeed> linerSpeedList = (List <DirverLinerspeed>)value;
                    if (linerSpeedList != null && linerSpeedList.Count > 0)
                    {
                        obj = linerSpeedList.Find(x => x.DlId == nDriverId);
                    }
                }
                #endregion
                break;

            case 8:
                #region 行星齿轮箱
                if (value is List <DirverGearPlanet> )
                {
                    List <DirverGearPlanet> gearPlanetList = (List <DirverGearPlanet>)value;
                    if (gearPlanetList != null && gearPlanetList.Count > 0)
                    {
                        obj = gearPlanetList.Find(x => x.PId == nDriverId);
                    }
                }
                #endregion
                break;

            case 9:
                #region 转子/轴
                if (value is List <DirverRoller> )
                {
                    List <DirverRoller> rollerList = (List <DirverRoller>)value;
                    if (rollerList != null && rollerList.Count > 0)
                    {
                        obj = rollerList.Find(x => x.DrId == nDriverId);
                    }
                }

                #endregion
                break;

            case 11:
                #region 滚动轴承
                if (value is List <DirverBearing> )
                {
                    List <DirverBearing> bearingList = (List <DirverBearing>)value;
                    if (bearingList != null && bearingList.Count > 0)
                    {
                        obj = bearingList.Find(x => x.Id == nDriverId);
                    }
                }

                #endregion
                break;

            case 12:
                #region 滑动轴承
                if (value is List <DirverBearingSlide> )
                {
                    List <DirverBearingSlide> bearingSlideList = (List <DirverBearingSlide>)value;
                    if (bearingSlideList != null && bearingSlideList.Count > 0)
                    {
                        obj = bearingSlideList.Find(x => x.BsId == nDriverId);
                    }
                }

                #endregion
                break;

            case 13:
                if (value is List <DirverFluidcoupling> )
                {
                    List <DirverFluidcoupling> fluidCouplingList = (List <DirverFluidcoupling>)value;
                    if (fluidCouplingList != null && fluidCouplingList.Count > 0)
                    {
                        obj = fluidCouplingList.Find(x => x.FcId == nDriverId);
                    }
                }
                break;
            }
            if (inRpm < 0)
            {
                if (_machineRev != null)
                {
                    inRpm = (int)_machineRev.MrRev;
                }
                else
                {
                    inRpm = (int)dirver.Output;
                }
            }
            return(GetFeatureItem(nType, obj, inRpm));
        }