private object ToChannelIndexValue(ChannelMetadataRecord channel, IndexMetadataRecord index, DateTimeOffset indexDateTimeOffset) { if (index.IndexKind == ChannelIndexKind.Time) { return(indexDateTimeOffset.ToUnixTimeMicroseconds()); } object indexValue; if (ChannelStreamingInfo.ContainsKey(channel.Id)) { indexValue = ChannelStreamingInfo[channel.Id]; if (indexValue is double) { indexValue = (double)indexValue + Math.Pow(10, index.Scale) * 0.1; } } else { indexValue = 0d; } ChannelStreamingInfo[channel.Id] = indexValue; return(indexValue); }
private ChannelMetadataRecord ToChannelMetadataRecord(Trajectory entity, IndexMetadataRecord indexMetadata) { var uri = entity.GetUri(); var dataObject = new DataObject(); var lastChanged = entity.Citation.LastUpdate.ToUnixTimeMicroseconds().GetValueOrDefault(); StoreStoreProvider.SetDataObject(dataObject, entity, uri, entity.Citation.Title, 0, lastChanged); return(new ChannelMetadataRecord() { ChannelUri = uri, ContentType = uri.ContentType, DataType = [email protected](), Description = entity.Citation.Description ?? entity.Citation.Title, ChannelName = entity.Citation.Title, Uom = Units.GetUnit(entity.MDMin?.Uom.ToString()), MeasureClass = ObjectTypes.Unknown, Source = ObjectTypes.Unknown, Uuid = entity.Uuid, DomainObject = dataObject, Status = GetStatus(entity.GrowingStatus), StartIndex = entity.MDMin?.Value.IndexToScale(indexMetadata.Scale), EndIndex = entity.MDMax?.Value.IndexToScale(indexMetadata.Scale), Indexes = new List <IndexMetadataRecord>() { indexMetadata }, CustomData = new Dictionary <string, DataValue>() }); }
private long ToChannelIndexValue(ChannelStreamingInfo streamingInfo, IndexMetadataRecord index, DateTimeOffset indexDateTimeOffset) { if (index.IndexType == ChannelIndexTypes.Time) { return(indexDateTimeOffset.ToUnixTimeMicroseconds()); } var value = 0d; if (streamingInfo.StartIndex.Item is double) { value = (double)streamingInfo.StartIndex.Item + Math.Pow(10, index.Scale) * 0.1; } streamingInfo.StartIndex.Item = value; return((long)value); }
/// <summary> /// Converts a logCurveInfo to a channel metadata record. /// </summary> /// <param name="entity">The entity.</param> /// <param name="curve">The curve.</param> /// <param name="indexMetadata">The index metadata.</param> /// <returns></returns> protected override ChannelMetadataRecord ToChannelMetadataRecord(Log entity, LogCurveInfo curve, IndexMetadataRecord indexMetadata) { var uri = curve.GetUri(entity); var isTimeLog = IsTimeLog(entity, true); var curveIndexes = GetCurrentIndexRange(entity); var dataObject = new DataObject(); var unixTime = entity.CommonData.DateTimeLastChange.ToUnixTimeMicroseconds(); StoreStoreProvider.SetDataObject(dataObject, curve, uri, curve.Mnemonic.Value, 0, unixTime.GetValueOrDefault()); return(new ChannelMetadataRecord() { ChannelUri = uri, ContentType = uri.ContentType, DataType = curve.TypeLogData.GetValueOrDefault(LogDataType.@double).ToString().Replace("@", string.Empty), Description = curve.CurveDescription ?? curve.Mnemonic.Value, ChannelName = curve.Mnemonic.Value, Uom = Units.GetUnit(curve.Unit), MeasureClass = curve.ClassWitsml ?? ObjectTypes.Unknown, Source = curve.DataSource ?? ObjectTypes.Unknown, DomainObject = dataObject, Status = entity.ObjectGrowing.GetValueOrDefault() ? ChannelStatuses.Active : ChannelStatuses.Inactive, StartIndex = curveIndexes[curve.Mnemonic.Value].Start.IndexToScale(indexMetadata.Scale, isTimeLog), EndIndex = curveIndexes[curve.Mnemonic.Value].End.IndexToScale(indexMetadata.Scale, isTimeLog), Indexes = new List <IndexMetadataRecord>() { indexMetadata }, CustomData = new Dictionary <string, DataValue>() }); }
private ChannelMetadataRecord ToChannelMetadataRecord(ChannelMetadataRecord record, IndexMetadataRecord indexMetadata) { var uri = GetChannelUri(record.ChannelName); var channel = new ChannelMetadataRecord() { ChannelUri = uri, ContentType = uri.ContentType, ChannelId = record.ChannelId, ChannelName = record.ChannelName, Uom = record.Uom, MeasureClass = record.MeasureClass, DataType = record.DataType, Description = record.Description, Uuid = record.Uuid, Status = record.Status, Source = record.Source, Indexes = new[] { indexMetadata }, CustomData = new Dictionary <string, DataValue>() }; Channels.Add(channel); return(channel); }