Exemple #1
0
        void LoadSettings(TypeSize _p)
        {
            DefCL    dlc = new DefCL(Tp);
            L_L502Ch lch = dlc.LCh;

            borders      = new double[2];
            bordersIn    = new double[2];
            filterPars   = null;
            filterParsIn = null;
            Gains        = new double[lch.Count];
            for (int i_s = 0; i_s < Sensors; i_s++)
            {
                Gains[i_s] = lch[i_s].Gain;
            }

            borders[0]     = dlc.Border1;
            borders[1]     = dlc.Border2;
            bordersIn[0]   = dlc.Border1In;
            bordersIn[1]   = dlc.Border2In;
            DeadZoneStart  = dlc.DeadZoneStart;
            DeadZoneFinish = dlc.DeadZoneFinish;
            filterPars     = dlc.Filter.Clone();
            IsIn           = dlc.IsFinterIn;
            filterParsIn   = dlc.FilterIn.Clone();

            LenghtStart       = dlc.Tails.LenghtStart;
            LenghtEnd         = dlc.Tails.LenghtEnd;
            MultStart         = dlc.Tails.MultStart;
            MultEnd           = dlc.Tails.MultEnd;
            SampleRate        = dlc.L502.FrequencyPerChannel;
            ZoneSize          = ParAll.ST.ZoneSize;
            WidthMedianFilter = ParAll.ST.Defect.Some.WidthMedianFilter;
            IsMedianFilter    = ParAll.ST.Defect.Some.IsMedianFilter;
        }
Exemple #2
0
        public void Calc(int _sensor, Sensor _prev)
        {
            CalcMedianFilterPrev(_prev == null ? null : _prev.MMeas);
            double lGain = new DefCL(Tp).LCh[_sensor].Gain;

            CalcClassGain(lGain);
        }
Exemple #3
0
        public void SaveSettings(TypeSize _p)
        {
            DefCL    dcl = new DefCL(Tp);
            L_L502Ch lch = dcl.LCh;

            if (Sensors != lch.Count)
            {
                throw (new Exception("RDPars.SaveSettings: Не соответствует количество датчиков в текущем типоразмере"));
            }
            for (int i_s = 0; i_s < Sensors; i_s++)
            {
                lch[i_s].Gain = Gains[i_s];
            }
            dcl.Border1        = borders[0];
            dcl.Border2        = borders[1];
            dcl.Border1In      = bordersIn[0];
            dcl.Border2In      = bordersIn[1];
            dcl.DeadZoneStart  = DeadZoneStart;
            dcl.DeadZoneFinish = DeadZoneFinish;

            dcl.Filter = filterPars.Clone();
            if (filterParsIn != null)
            {
                dcl.FilterIn = filterParsIn.Clone();
            }

            dcl.Tails.LenghtStart                   = LenghtStart;
            dcl.Tails.LenghtEnd                     = LenghtEnd;
            dcl.Tails.MultStart                     = MultStart;
            dcl.Tails.MultEnd                       = MultEnd;
            dcl.L502.FrequencyPerChannel            = SampleRate;
            ParAll.ST.ZoneSize                      = ZoneSize;
            ParAll.ST.Defect.Some.WidthMedianFilter = WidthMedianFilter;
            ParAll.ST.Defect.Some.IsMedianFilter    = IsMedianFilter;
        }
Exemple #4
0
        public BankCLUnitA(EUnit _type, cIW _IW)
            : base(_type)
        {
            Clear();
            DefCL dcl = new DefCL(Tp);

            //            f_acq = (dcl.LCh.Count + (_IW.SG ? 2 : 0)) * dcl.L502.FrequencyPerChannel;
            f_acq = dcl.LCh.Count * dcl.L502.FrequencyPerChannel;
        }
Exemple #5
0
        void SetGainsToPars()
        {
            L_L502Ch lch = new DefCL(Tp).LCh;

            for (int i = 0; i < L.Count; i++)
            {
                lch[i].Gain = L[i].Gain;
            }
        }
Exemple #6
0
        void SetGainsFromPars()
        {
            DefCL dcl = new DefCL(Tp);

            for (int i = 0; i < L.Count; i++)
            {
                L[i].Gain = dcl.LCh[i].Gain;
            }
        }
Exemple #7
0
        // ---------------------------------------------------------------------------
        public double GetValueP(L502Ch _channel, ref bool _ret)
        {
            if (started)
            {
                throw (new Exception("JCollect.GetValueP: Нельзя получать значения стартовавшего сборщика"));
            }
            DefCL dcl = new DefCL(Tp);

            return(lcard.GetValueP(_channel, dcl.L502, ref _ret));
        }
Exemple #8
0
        public void StartL502(L502Ch[] _channels)
        {
            if (!lcard_local)
            {
                return;
            }
            if (lcard == null)
            {
                return;
            }
            DefCL dcl = new DefCL(EUnit.Cross);

            lcard.Start(dcl.L502, _channels);
        }
Exemple #9
0
        public void LoadSettings()
        {
            DefCL dcl = new DefCL(Tp);

            SensorsPosition = dcl.SensorsPosition;
            Sensors         = dcl.LCh.Count;
            MOffset         = new double[Sensors];
            for (int i = 0; i < Sensors; i++)
            {
                MOffset[i] = dcl.LCh[i].IOffset;
            }
            ReSize(dcl.Buffer * 1024 * 1024 / sizeof(double));
            ZoneLength = ParAll.ST.ZoneSize;
            SetDeadEnd(ParAll.ST.ZoneSize, dcl.DeadZoneFinish);
            SetDeadEnd(ParAll.ST.ZoneSize, Convert.ToInt32(Math.Ceiling(dcl.MultEnd)));

            Clear();
        }
Exemple #10
0
 public FMeases(string _title, CursorBorder _cursorBorder, EUnit _tp)
 {
     InitializeComponent();
     title         = _title;
     Source        = new RUnit(RUnit.EType.Source, chart1.Series[0], chart1.ChartAreas[0].AxisY, CBSource, "Исходный сигнал", toolTip1);
     Median        = new RUnit(RUnit.EType.Median, chart1.Series[1], chart1.ChartAreas[0].AxisY, CBMedian, "Медианный сигнал", toolTip1);
     Filter        = new RUnit(RUnit.EType.Filter, chart1.Series[2], chart1.ChartAreas[0].AxisY, CBFilter, "Фильтрованный сигнал", toolTip1);
     FilterIn      = new RUnit(RUnit.EType.FilterIn, chart1.Series[3], chart1.ChartAreas[0].AxisY, CBFilterIn, "Фильтрованный внутренний сигнал", toolTip1);
     OnHide        = null;
     cursor        = new RCursor(chart1);
     cursor.OnMove = OnMove;
     label1.Text   = null;
     label2.Text   = null;
     cursorBorder  = _cursorBorder;
     OnHide        = ExecHide;
     Tp            = _tp;
     dcl           = new DefCL(_tp);
 }
Exemple #11
0
        public void Load(BinaryReader _br, int _version)
        {
            MZone.Clear();
            MZone.Capacity = _br.ReadInt16();
            int      lsen = _br.ReadInt16();
            L_L502Ch lch  = new DefCL(Tp).LCh;

            if (lch.Count != lsen)
            {
                throw (new Exception("Количество датчиков в настройках не соответствует количеству датчиков в файле данных"));
            }
            for (int iz = 0; iz < MZone.Capacity; iz++)
            {
                Zone z = new Zone(Tp);
                z.Load(_br, lsen, _version);
                MZone.Add(z);
            }
        }
Exemple #12
0
        public void Start(int _startTick)
        {
            if (bank == null)
            {
                return;
            }
            if (started)
            {
                Finish(_startTick);
            }

            DefCL dcl = new DefCL(Tp);

            ReadPeriod = dcl.L502.ReadPeriod;
            List <L502Ch> L = new List <L502Ch>();

            if (Tp == EUnit.Line)
            {
                for (int i = 0; i < dcl.LCh.Count; i++)
                {
                    L.Add(dcl.LCh[i]);
                }
            }
            if (Tp == EUnit.Cross)
            {
                if (IW.Cross)
                {
                    for (int i = 0; i < dcl.LCh.Count; i++)
                    {
                        L.Add(dcl.LCh[i]);
                    }
                }
                if (IW.SG)
                {
                    L.Add(ParAll.SG.Sensor_I);
                    L.Add(ParAll.SG.Sensor_B);
                }
            }
            lcard.Start(dcl.L502, L.ToArray());
            started        = true;
            bank.FirstTick = _startTick;
        }
Exemple #13
0
        new void Init()
        {
            int iz0;
            int iz1;

            if (range == 0)
            {
                iz0  = RK.ST.cDef(Tp).Zone.Value;
                iz1  = RK.ST.cDef(Tp).Zone.Value;
                Text = string.Format("{0}: Зона: {1}, Датчик: {2}", title, iz0 + 1, RK.ST.cDef(Tp).Sensor.Value + 1);
            }
            else
            {
                iz0 = RK.ST.cDef(Tp).Zone.Value - range / 2;
                iz1 = iz0 + range - 1;
                if (iz0 < 0)
                {
                    iz0 = 0;
                }
                if (iz1 >= RK.ST.cDef(Tp).result.MZone.Count)
                {
                    iz1 = RK.ST.cDef(Tp).result.MZone.Count - 1;
                }
                Text = string.Format("{0}: Зоны с {1} по {2}, Датчик: {3}", title, iz0 + 1, iz1 + 1, RK.ST.cDef(Tp).Sensor.Value + 1);
            }
            DefCL dcl = new DefCL(Tp);

            uSensorData1.InitRange(RK.ST.cDef(Tp).result, iz0, iz1, RK.ST.cDef(Tp).Sensor.Value,
                                   dcl.LCh[RK.ST.cDef(Tp).Sensor.Value].Gain);
            zone_size = ParAll.ST.ZoneSize;
            if (range == 0)
            {
                cursorBorder.DrawSingle(iz0, RK.ST.cDef(Tp).Sensor.Value);
            }
            else
            {
                cursorBorder.DrawLine(iz0, iz1, RK.ST.cDef(Tp).Sensor.Value);
            }
            base.Init();
        }
Exemple #14
0
        public void InitRange(ResultDef _resultDef, int _iz0, int _iz1, int _is, double _gain)
        {
            chart1.Series.SuspendUpdates();
            Clear();
            TypeSize ts = ParAll.ST.TSSet.Current;

            resultDef = _resultDef;
            iz0       = _iz0;
            iz1       = _iz1;
            ise       = _is;
            Color DeviderColor      = ParAll.ST.Some.SignalsView.DeviderColor;
            DataPointCollection p   = chart1.Series[0].Points;
            DataPointCollection pIn = chart1.Series[0].Points;
            int ip     = 0;
            int ipIn   = 0;
            int istrip = 0;

            chart1.ChartAreas[0].AxisX.StripLines.Clear();
            DefCL dcl  = new DefCL(_resultDef.Tp);
            bool  IsIn = dcl.IsFinterIn;

            for (int ii = _iz0; ii <= _iz1; ii++)
            {
                Meas[] MMeas = _resultDef.MZone[ii].MSensor[ise].MMeas;
                if (istrip > 0)
                {
                    StripLine sl = new StripLine();
                    sl.BorderColor    = DeviderColor;
                    sl.BorderWidth    = 2;
                    sl.IntervalOffset = ip;
                    chart1.ChartAreas[0].AxisX.StripLines.Add(sl);
                }
                istrip++;
                for (int i = 0; i < MMeas.Length; i++)
                {
                    Meas      m  = MMeas[i];
                    DataPoint dp = new DataPoint(ip, m.FilterABC * _gain);
                    dp.Color = m.Dead ? Classer.GetColor(EClass.None) : Classer.GetColor(m.Class);
                    dp.Tag   = new PointSubj(ii, ise, i);
                    p.Add(dp);
                    ip++;
                    if (IsIn)
                    {
                        pIn.AddXY(ipIn, -m.FilterInABC * _gain);
                        p[ipIn].Color = m.Dead ? Classer.GetColor(EClass.None) : Classer.GetColor(m.ClassIn);
                        ipIn++;
                    }
                }
                istrip++;
            }
            if (bline != null)
            {
                bline.Visible = false;
            }
            if (blineIn != null)
            {
                blineIn.Visible = false;
            }
            bline   = new BorderLine(chart1.ChartAreas[0].AxisY, Classer.GetColor(EClass.Brak), Classer.GetColor(EClass.Class2));
            blineIn = new BorderLine(chart1.ChartAreas[0].AxisY, Classer.GetColor(EClass.Brak), Classer.GetColor(EClass.Class2));
            bline.SetBorders(dcl.Borders);
            bline.Visible = true;

            if (IsIn)
            {
                double[] borders = new double[2];
                borders[0] = -dcl.Border1In;
                borders[1] = -dcl.Border2In;
                blineIn.SetBorders(borders);
                blineIn.Visible = true;
            }
            chart1.ChartAreas[0].AxisY.Maximum = 100;
            if (IsIn)
            {
                chart1.ChartAreas[0].AxisY.Minimum = -100;
            }
            else
            {
                chart1.ChartAreas[0].AxisY.Minimum = 0;
            }
            if (cursor.Visible)
            {
                OnMove(cursor.Position);
            }
            chart1.Series[0].Enabled = true;
            chart1.Series[1].Enabled = IsIn;
            chart1.Series.ResumeUpdates();
        }
Exemple #15
0
        protected bool CalcXStart(int _zone, bool _dead)
        {
            DefCL dcl = new DefCL(Tp);
            int   lLength;

            if (_dead)
            {
                lLength = dcl.DeadZoneFinish;
            }
            else
            {
                lLength = dcl.Tails.LenghtEnd;
            }
            if (lLength == 0)
            {
                return(false);
            }
            if (!_dead && dcl.Tails.MultStart == 1)
            {
                return(false);
            }
            Zone Z = MZone[_zone];

            int pos_start = _zone * ParAll.ST.ZoneSize;
            int pos_end   = pos_start + ParAll.ST.ZoneSize;

            if (pos_start > lLength)
            {
                return(false);
            }
            if (pos_end <= lLength)
            {
                for (int s = 0; s < Z.MSensor.Length; s++)
                {
                    Sensor S = Z.MSensor[s];
                    for (int m = 0; m < S.MMeas.Count(); m++)
                    {
                        if (_dead)
                        {
                            S.MMeas[m].Dead = true;
                        }
                        else
                        {
                            S.MMeas[m].Source *= dcl.Tails.MultStart;
                        }
                    }
                }
                return(true);
            }
            for (int s = 0; s < Z.MSensor.Count(); s++)
            {
                Sensor S     = Z.MSensor[s];
                double delta = lLength - pos_start;
                double K     = delta / ParAll.ST.ZoneSize;
                double X     = K * S.MMeas.Count();
                int    x     = (int)X;
                for (int m = 0; m < x; m++)
                {
                    if (_dead)
                    {
                        S.MMeas[m].Dead = true;
                    }
                    else
                    {
                        S.MMeas[m].Source *= dcl.Tails.MultStart;
                    }
                }
            }
            return(true);
        }
Exemple #16
0
        void CalcXEnd(bool _dead)
        {
            DefCL dcl = new DefCL(Tp);
            int   lLength;

            if (_dead)
            {
                lLength = dcl.DeadZoneFinish;
            }
            else
            {
                lLength = dcl.Tails.LenghtEnd;
            }
            if (lLength == 0)
            {
                return;
            }
            if (!_dead && dcl.Tails.MultStart == 1)
            {
                return;
            }

            int pos_start = 0;

            for (int z = MZone.Count() - 1; z >= 0; z--)
            {
                Zone Z       = MZone[z];
                int  pos_end = pos_start + Z.VZoneLength;
                if (pos_end <= lLength)
                {
                    for (int s = 0; s < Z.MSensor.Count(); s++)
                    {
                        Sensor S = Z.MSensor[s];
                        for (int m = 0; m < S.MMeas.Count(); m++)
                        {
                            if (_dead)
                            {
                                S.MMeas[m].Dead = true;
                            }
                            else
                            {
                                S.MMeas[m].Source *= dcl.Tails.MultStart;
                            }
                        }
                    }
                }
                else
                {
                    double delta = lLength - pos_start;
                    double K     = delta / Z.VZoneLength;
                    for (int s = 0; s < Z.MSensor.Count(); s++)
                    {
                        Sensor S = Z.MSensor[s];
                        double X = K * S.MMeas.Count();
                        int    x = S.MMeas.Count() - (int)X;
                        for (int m = S.MMeas.Count() - 1; m >= x; m--)
                        {
                            if (_dead)
                            {
                                S.MMeas[m].Dead = true;
                            }
                            else
                            {
                                S.MMeas[m].Source *= dcl.Tails.MultStart;
                            }
                        }
                    }
                    break;
                }
                pos_start += Z.VZoneLength;
            }
        }