コード例 #1
0
ファイル: DevKit200Aspect.cs プロジェクト: pyerbiz/witsml
        /// <summary>
        /// Initializes the channel set.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="indexList">The index list.</param>
        /// <param name="loggingMethod">The logging method.</param>
        /// <param name="numDataValue">The number data value.</param>
        public void InitChannelSet(Log log, List <ChannelIndex> indexList, LoggingMethod loggingMethod = LoggingMethod.computed, int numDataValue = 150)
        {
            ChannelSet channelSet = LogGenerator.CreateChannelSet(log);

            channelSet.Index = indexList;
            bool isDepth = log.TimeDepth.EqualsIgnoreCase(ObjectFolders.Depth);

            if (isDepth)
            {
                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Quality", "Quality", EtpDataType.boolean));

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, indexList, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, indexList, "Hookload", "HKLD", UnitOfMeasure.klbf, "Force", EtpDataType.@double, null));
            }
            else
            {
                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Confidence", "Confidence", EtpDataType.@float));

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, indexList, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
            }

            log.ChannelSet = new List <ChannelSet>();
            log.ChannelSet.Add(channelSet);

            LogGenerator.GenerateChannelData(log.ChannelSet, numDataValue: numDataValue);
        }
コード例 #2
0
        public void Channel200DataAdapter_UpdateChannelData_With_Special_Characters()
        {
            AddParents();

            // Initialize ChannelSet
            var mdChannelIndex = LogGenerator.CreateMeasuredDepthIndex(IndexDirection.increasing);

            DevKit.InitHeader(Log, LoggingMethod.MWD, mdChannelIndex);

            // Add special channels
            var channelSet = Log.ChannelSet.First();

            channelSet.Channel.Add(LogGenerator.CreateChannel(Log, channelSet.Index, "Message", "MSG", null, "none", EtpDataType.@string, null));
            channelSet.Channel.Add(LogGenerator.CreateChannel(Log, channelSet.Index, "Count", "CNT", null, "none", EtpDataType.@long, null));

            // Initialize data block
            var uri       = channelSet.GetUri();
            var dataBlock = new ChannelDataBlock(uri);
            var channelId = 1;
            var numRows   = ChannelDataBlock.BatchSize;
            var flushRate = ChannelDataBlock.BlockFlushRateInMilliseconds;

            foreach (var channelIndex in channelSet.Index)
            {
                dataBlock.AddIndex(channelIndex);
            }

            foreach (var channel in channelSet.Channel)
            {
                dataBlock.AddChannel(channelId++, channel);
            }

            LogGenerator.GenerateChannelData(dataBlock, numRows);

            var reader = dataBlock.GetReader();

            Assert.IsTrue(reader.Read());

            // Read the first value for mnemonic "MSG"
            var msgValue = reader["MSG"];

            // Submit channel data
            _channelDataProvider.UpdateChannelData(uri, dataBlock.GetReader());

            var mnemonics = channelSet.Index.Select(i => i.Mnemonic)
                            .Concat(channelSet.Channel.Select(c => c.Mnemonic))
                            .ToList();

            // Query channel data
            var dataOut = _channelDataProvider.GetChannelData(uri, new Range <double?>(0, null), mnemonics, null);

            // Assert
            Assert.AreEqual(numRows, dataOut.Count);
            Assert.AreEqual(numRows, dataBlock.Count());
            Assert.AreEqual(2, dataOut[0].Count);
            Assert.AreEqual(5, dataOut[0][1].Count);
            Assert.AreEqual(msgValue, dataOut[0][1][3]);
            Assert.IsTrue(flushRate > 1000);
        }
コード例 #3
0
ファイル: DevKit200Aspect.cs プロジェクト: pyerbiz/witsml
        public void InitHeader(Log log, LoggingMethod loggingMethod, ChannelIndex channelIndex, IndexDirection direction = IndexDirection.increasing)
        {
            log.ChannelSet    = new List <ChannelSet>();
            log.LoggingMethod = loggingMethod;

            var index = List(channelIndex);

            if (channelIndex.IndexType == ChannelIndexType.measureddepth)
            {
                log.TimeDepth = "depth";

                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Quality", "Quality", EtpDataType.boolean));

                ChannelSet channelSet = LogGenerator.CreateChannelSet(log);
                channelSet.Index = index;

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Hookload", "HKLD", UnitOfMeasure.klbf, "Force", EtpDataType.@double, null));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "GR1AX", "GR", UnitOfMeasure.gAPI, "Gamma_Ray", EtpDataType.@double, null));

                CreateMockChannelSetData(channelSet, channelSet.Index);
                log.ChannelSet.Add(channelSet);
            }
            else if (channelIndex.IndexType == ChannelIndexType.datetime)
            {
                log.TimeDepth = "time";

                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Confidence", "Confidence", EtpDataType.@float));

                ChannelSet channelSet = LogGenerator.CreateChannelSet(log);
                channelSet.Index = index;

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "GR1AX", "GR", UnitOfMeasure.gAPI, "Gamma_Ray", EtpDataType.@double, null));

                CreateMockChannelSetData(channelSet, channelSet.Index);
                log.ChannelSet.Add(channelSet);
            }
        }