示例#1
0
        /// <summary>
        /// 解析前初期化処理
        /// </summary>
        /// <param name="ch_setting"></param>
        /// <param name="meas_setting"></param>
        /// <param name="folderPath"></param>
        public void InitializeforAnalysis(AnalyzeData parent)
        {
            //親クラス参照設定
            AnalyzeData_Parent = parent;

            calcDatas = new CalcDataManager(parent.DataTagSetting, parent.ConstantSetting, parent.TagChannelRelationSetting, parent.MeasureSetting);
            
            calcDatas.Init();
        }
示例#2
0
        /// <summary>
        /// 範囲取得
        /// </summary>
        /// <param name="_startindex">開始位置</param>
        /// <param name="length">取得長さ</param>
        /// <param name="sampleDatas">サンプルデータ格納領域</param>
        /// <param name="calcDatas">演算データ測定領域</param>
        /// <returns>実際の取得サイズ</returns>
        public int GetRange(int _startindex, int length , out List<SampleData> sampleDatas , out List<CalcData> calcDatas )
        {
            //データ取得
            sampleDatas = this.SampleDatas.GetRange(_startindex, length);

            #region モード1時のオフセット設定
            ////モード1時のオフセット設定
            //if (AnalyzeData_Parent.MeasureSetting.Mode == (int)ModeType.MODE1)
            //{
            foreach (SampleData sdata in sampleDatas)
            {
                //チャンネル分ループ
                for (int i = 1; i < sdata.ChannelDatas.Length; i++)
                {
                    if (sdata.ChannelDatas[i] == null) continue;
                    if (sdata.ChannelDatas[i].DataValues == null) continue;

                    #region モード1時のオフセット対応
                    //モード1 で チャンネルがBかRならば
                    bool bOffsetCalc = (AnalyzeData_Parent.MeasureSetting.Mode == (int)ModeType.MODE1) &&
                                        (AnalyzeData_Parent.ChannelsSetting.ChannelSettingList[i - 1].ChKind == ChannelKindType.B
                                            || AnalyzeData_Parent.ChannelsSetting.ChannelSettingList[i - 1].ChKind == ChannelKindType.R);

                    #endregion


                    ////チャンネルがBかRならば
                    //if (AnalyzeData_Parent.ChannelsSetting.ChannelSettingList[i - 1].ChKind == ChannelKindType.B
                    //    || AnalyzeData_Parent.ChannelsSetting.ChannelSettingList[i - 1].ChKind == ChannelKindType.R)
                    //{
                    //TagNo1でチェック
                    if (AnalyzeData_Parent.TagChannelRelationSetting.RelationList[i].TagNo_1 != -1)
                    {
                        int tmpTagNo = AnalyzeData_Parent.TagChannelRelationSetting.RelationList[i].TagNo_1;

                        //ノーマルデータ
                        if (sdata.ChannelDatas[i].DataValues is Value_Standard)
                        {
                            if (bOffsetCalc)
                                ((Value_Standard)sdata.ChannelDatas[i].DataValues).Value -= AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).StaticZero;

                            // 桁切り計算
                            ((Value_Standard)sdata.ChannelDatas[i].DataValues).Value =
                                (decimal)ToRoundDown((double)((Value_Standard)sdata.ChannelDatas[i].DataValues).Value, AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).Point);

                        }
                        //MaxMinデータ
                        else if (sdata.ChannelDatas[i].DataValues is Value_MaxMin)
                        {
                            if (bOffsetCalc)
                            {
                                //MaxとMinとの差異が5umの場合MaxにMinを入れる(差を見せない)
                                if (((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MaxValue - ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MinValue <= 5)
                                    ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MaxValue = ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MinValue;

                                ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MaxValue -= AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).StaticZero;
                            }

                            // 桁切り計算
                            ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MaxValue =
                                (decimal)ToRoundDown((double)((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MaxValue, AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).Point);

                        }
                        //Mode2データ
                        else if (sdata.ChannelDatas[i].DataValues is Value_Mode2)
                        {
                            for (int sampleindex = 0; sampleindex < ((Value_Mode2)sdata.ChannelDatas[i].DataValues).Values.Length; sampleindex++)
                            {
                                ((Value_Mode2)sdata.ChannelDatas[i].DataValues).Values[sampleindex] =
                                    (decimal)ToRoundDown((double)((Value_Mode2)sdata.ChannelDatas[i].DataValues).Values[sampleindex], AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).Point);
                            }
                        }
                    }

                    //TagNo2 でチェック
                    if (AnalyzeData_Parent.TagChannelRelationSetting.RelationList[i].TagNo_2 != -1)
                    {
                        int tmpTagNo = AnalyzeData_Parent.TagChannelRelationSetting.RelationList[i].TagNo_2;

                        //ノーマルならば使わない
                        if (sdata.ChannelDatas[i].DataValues is Value_Standard ||
                            sdata.ChannelDatas[i].DataValues is Value_Mode2)
                        {
                        }
                        //MaxMinでデータを使う
                        else
                        {
                            if (bOffsetCalc)
                                ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MinValue -= AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).StaticZero;

                            // 桁切り計算
                            ((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MinValue =
                                (decimal)ToRoundDown((double)((Value_MaxMin)sdata.ChannelDatas[i].DataValues).MinValue, AnalyzeData_Parent.DataTagSetting.GetTag(tmpTagNo).Point);

                        }
                    }
                }
            }

            //}

            //}
            #endregion

            //演算処理
            calcDatas = this.CalcDatas.GetRange(_startindex, length, sampleDatas);


            //次回データの取得を別スレッドで実施。
            //モード2のみ
            if (this.SampleDatas.HeaderData.Mode == ModeType.MODE2)
            {
                System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(GetNextRange));
                th.Start(new int[] { _startindex + 1, 1 });
            }

            return sampleDatas.Count;
        }
示例#3
0
        public object Clone()
        {
            CalcDataManager ret = new CalcDataManager();

            ret.CalcDatas = new List<CalcData>(this.CalcDatas);

            ret.calcinitFlag = this.calcinitFlag;
            if(this.dataTagSetting != null)
                ret.dataTagSetting = (DataTagSetting)this.dataTagSetting.Clone();
            if(this.constantSetting != null)
                ret.constantSetting = (ConstantSetting)this.constantSetting.Clone();
            if(this.tagChannelRelationSetting != null)
                ret.tagChannelRelationSetting = (TagChannelRelationSetting)this.tagChannelRelationSetting.Clone();
            if (this.measureSetting != null)
                ret.measureSetting = (MeasureSetting)this.measureSetting.Clone();

            for (int i = 0; i < list.Count; i++)
            {
                ret.list.Add((DataTag)list[i].Clone());
            }

            ret.CurFilePath = this.CurFilePath;

            if(this.sampleDatas != null)
                ret.sampleDatas = (SampleDataManager)this.sampleDatas.Clone();

            ret.calcCount = this.calcCount;

            ret.strErrorMessage = this.strErrorMessage;

            if (this.valConstant != null)
                ret.valConstant = new List<double>(this.valConstant).ToArray();

            if( this.strConstantName != null)
                ret.strConstantName = new List<string>(this.strConstantName).ToArray();

            if (this.valVariable != null)
                ret.valVariable = new List<double>(this.valVariable).ToArray();

            ret.dataHandleVar = this.dataHandleVar;

            if (this.strVariableName != null)
                ret.strVariableName = new List<string>(this.strVariableName).ToArray();

            if (this.strCalcName != null)
                ret.strCalcName = new List<string>(this.strCalcName).ToArray();

            if (this.strExpression != null)
                ret.strExpression = new List<string>(this.strExpression).ToArray();

            if(this.iCalcIndex != null)
                ret.iCalcIndex = new List<int>(this.iCalcIndex).ToArray();

            if(this.valCalcResult != null)
                ret.valCalcResult = new List<double>(this.valCalcResult).ToArray();

            ret.dataHandleCalc = this.dataHandleCalc;

            if(this.calc != null)
                ret.calc = new Calc();

            if(this.calclock != null)
                ret.calclock = new object();

            ret.FolderPath = this.FolderPath;
            ret.icount = this.icount;
            ret.startIndex = this.startIndex;
            ret.endIndex = this.endIndex;
            ret.SamplesCount = this.SamplesCount;

            return ret;
        }