コード例 #1
0
ファイル: Value_MaxMin.cs プロジェクト: kse-jp/RM-3000
        public override object Clone()
        {
            Value_MaxMin ret = new Value_MaxMin();

            ret.bCheckValue = this.bCheckValue;
            ret.FilePath = this.FilePath;
            ret.IsUpdated = this.IsUpdated;
            ret.TypeOfClass = this.TypeOfClass;
            ret.MinValue = this.MinValue;
            ret.MaxValue = this.MaxValue;

            return ret;
        }
コード例 #2
0
ファイル: TestSequence.cs プロジェクト: kse-jp/RM-3000
        /// <summary>
        /// モード1データのセット
        /// </summary>
        /// <param name="reserveData"></param>
        /// <param name="sampleData"></param>
        private void SetMode1Data(Mode1Record reserveData, ref SampleData sampleData)
        {

            if(((Mode1Header)reserveData.HeaderData).Time.Hour == 23 && DateTime.Now.Hour == 0)
                sampleData.SampleTime = DateTime.Today.AddDays(-1).AddTicks(((Mode1Header)reserveData.HeaderData).Time.Ticks);
            else
                sampleData.SampleTime = DateTime.Today.AddTicks(((Mode1Header)reserveData.HeaderData).Time.Ticks);


            sampleData.ChannelDatas = new ChannelData[11];
            Value_Standard valuedata = null;
            Value_MaxMin valueMaxMin = null;

            //データ取得用オフセット
            int dataoffset = 0;

            //チャンネル分+回転数分ループ
            for (int channelIndex = 0; channelIndex < channelEnables.Length + 1 ; channelIndex++)
            {
                if (channelIndex != 0 && !ChannelEnables[channelIndex - 1]) continue;

                sampleData.ChannelDatas[channelIndex] = new ChannelData();
                sampleData.ChannelDatas[channelIndex].Position = channelIndex;


                //回転数の場合
                if (channelIndex == 0)
                {
                    valuedata = new Value_Standard();

                    valuedata.Value = ((Mode1Header)reserveData.HeaderData).RevolutionSpeed;

                    sampleData.ChannelDatas[channelIndex].DataValues = valuedata;
                }
                else
                {
                    //モード1データを生成

                    //センサ種により処理分け
                    switch (channelsSetting.ChannelSettingList[channelIndex - 1].ChKind)
                    {
                        case ChannelKindType.B:
                            valuedata = new Value_Standard();

                            //温度補償
                            valuedata.Value = CalcOperator.Calc(channelIndex - 1, 
                                reserveData.MeasData.chData[dataoffset + 2], 
                                reserveData.MeasData.chData[dataoffset],
                                (reserveData.MeasData.chData[dataoffset + 1] == 0xFFFF ? -1 : reserveData.MeasData.chData[dataoffset + 1]));

                            //valuedata.Value = SystemSetting.CalibrationTables[channelIndex - 1].Calc(
                            //    reserveData.MeasData.chData[dataoffset + 2]
                            //    , reserveData.MeasData.chData[dataoffset]
                            //    , reserveData.MeasData.chData[dataoffset + 1]);
                            //chData[dataoffset + 2] == AD値
                            //chData[dataoffset] == 最大振幅
                            //chData[dataoffset + 1] == 温度データ

                            ////臨時
                            //valuedata.Value = reserveData.MeasData.chData[dataoffset + 2];

                            sampleData.ChannelDatas[channelIndex].DataValues = valuedata;
                            break;

                        case ChannelKindType.R:
                            //最終データが無効値ならば通常データ
                            if (reserveData.MeasData.chData[dataoffset + 2] == 0xFFFF)
                            {
                                valuedata = new Value_Standard();

                                //温度補償
                                valuedata.Value = CalcOperator.Calc(channelIndex - 1
                                    , reserveData.MeasData.chData[dataoffset + 1]
                                    , tempValue:(reserveData.MeasData.chData[dataoffset] == 0xFFFF ? -1 : reserveData.MeasData.chData[dataoffset]));

                                //valuedata.Value = SystemSetting.CalibrationTables[channelIndex - 1].Calc(
                                //    reserveData.MeasData.chData[dataoffset + 1]
                                //    , -1
                                //    , reserveData.MeasData.chData[dataoffset]);

                                //温度補償必要
                                //chData[dataoffset] == 温度データ
                                //chData[dataoffset + 1] == AD値

                                //臨時
                                //valuedata.Value = reserveData.MeasData.chData[dataoffset + 1];

                                sampleData.ChannelDatas[channelIndex].DataValues = valuedata;
                            }
                            else
                            {
                                valueMaxMin = new Value_MaxMin();


                                //最大値温度補償
                                valueMaxMin.MaxValue = CalcOperator.Calc(channelIndex - 1
                                    , reserveData.MeasData.chData[dataoffset + 1]
                                    , tempValue:(reserveData.MeasData.chData[dataoffset] == 0xFFFF ? -1 : reserveData.MeasData.chData[dataoffset]));

                                //valueMaxMin.MaxValue = SystemSetting.CalibrationTables[channelIndex - 1].Calc(
                                //    reserveData.MeasData.chData[dataoffset + 1]
                                //    , -1
                                //    , reserveData.MeasData.chData[dataoffset]);

                                //最小値温度補償
                                valueMaxMin.MinValue = CalcOperator.Calc(channelIndex - 1
                                    , reserveData.MeasData.chData[dataoffset + 2]
                                    , tempValue:(reserveData.MeasData.chData[dataoffset] == 0xFFFF ? -1 : reserveData.MeasData.chData[dataoffset]));

                                //valueMaxMin.MinValue = SystemSetting.CalibrationTables[channelIndex - 1].Calc(
                                //    reserveData.MeasData.chData[dataoffset + 2]
                                //    , -1
                                //    , reserveData.MeasData.chData[dataoffset]);

                                //温度補償必要
                                //chData[dataoffset] == 温度データ
                                //chData[dataoffset + 1] == MAX AD値
                                //chData[dataoffset + 2] == MIN AD値

                                //臨時
                                //valueMaxMin.MaxValue = reserveData.MeasData.chData[dataoffset + 1];
                                //valueMaxMin.MinValue = reserveData.MeasData.chData[dataoffset + 2];

                                sampleData.ChannelDatas[channelIndex].DataValues = valueMaxMin;

                            }
                            break;

                        default:
                            //B,Rセンサ以外は1つ目がデータ
                            valuedata = new Value_Standard();
                            //補償演算
                            valuedata.Value = CalcOperator.Calc(channelIndex - 1, reserveData.MeasData.chData[dataoffset]);

                            //valuedata.Value = reserveData.MeasData.chData[dataoffset];

                            sampleData.ChannelDatas[channelIndex].DataValues = valuedata;

                            break;
                    }

                    dataoffset += 3;
                }
            }
        }