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);
        }
示例#2
0
        /// <summary>
        /// Creates the log.
        /// </summary>
        /// <param name="indexType">Type of the index.</param>
        /// <param name="isIncreasing">if set to <c>true</c> [is increasing].</param>
        /// <returns></returns>
        public Log CreateLog(ChannelIndexType indexType, bool isIncreasing)
        {
            Log log = new Log();

            log.Citation = Citation("ChannelSet");
            log.Uuid     = Uid();

            log.ChannelSet = new List <ChannelSet>();
            log.Wellbore   = DataObjectReference(ObjectTypes.Wellbore, Name("Wellbore"), Uid());

            List <ChannelIndex> indexList = new List <ChannelIndex>();
            IndexDirection      direction = isIncreasing ? IndexDirection.increasing : IndexDirection.decreasing;

            if (LogGenerator.DepthIndexTypes.Contains(indexType))
            {
                log.TimeDepth = ObjectFolders.Depth;
                ChannelIndex channelIndex = LogGenerator.CreateMeasuredDepthIndex(direction);

                if (indexType.Equals(ChannelIndexType.trueverticaldepth))
                {
                    channelIndex = LogGenerator.CreateTrueVerticalDepthIndex(direction);
                }
                else if (indexType.Equals(ChannelIndexType.passindexeddepth))
                {
                    channelIndex = LogGenerator.CreatePassIndexDepthIndex(direction);
                }

                indexList.Add(channelIndex);
            }
            else if (LogGenerator.TimeIndexTypes.Contains(indexType))
            {
                log.TimeDepth = ObjectFolders.Time;

                if (indexType.Equals(ChannelIndexType.datetime))
                {
                    // DateTime should be increasing only
                    indexList.Add(LogGenerator.CreateDateTimeIndex());
                }
                else if (indexType.Equals(ChannelIndexType.elapsedtime))
                {
                    indexList.Add(LogGenerator.CreateElapsedTimeIndex(direction));
                }
            }
            else
            {
                log.TimeDepth = ObjectFolders.Other;
                return(null);
            }

            InitChannelSet(log, indexList);

            return(log);
        }
        public void Log200DataAdapter_Can_Add_And_Get_Log()
        {
            AddParents();

            var mdChannelIndex = LogGenerator.CreateMeasuredDepthIndex(IndexDirection.increasing);

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

            DevKit.AddAndAssert(Log);
            var log = DevKit.GetAndAssert(Log);

            Assert.AreEqual(Log.Citation.Title, log.Citation.Title);
            Assert.AreEqual(Log.Uuid, log.Uuid);
        }