Map Data Format

About this task

For the ODBC collector to interpret the received data accurately, you must map the format and structure of the data between the ODBC server and Historian.

Procedure

  1. Access the ODBC_Mapping.xml file. By default, this file is located at C:\Program Files\GE Digital\Historian ODBC Collector\Server. In the ODBC collector registry path, this file is stored in the Mapping File variable.
  2. For each data type in the ODBC server, add an entry in the equivalent Historian data type as described in the following table. If a Historian data type does not have an equivalent ODBC data type, enter *NA*.
    Historian Data Type ODBC Server Data Type
    ihByte Byte
    ihFloat SingleFloat
    ihDoubleFloat DoubleFloat
    ihInteger SingleInteger
    ihDoubleInteger DoubleInteger
    ihScaled *NA*
    ihFixedString *NA*
    ihVariableString *NA*
    ihBlob *NA*
    ihTime *NA*
    ihInt64 *NA*
    ihUInt64 *NA*
    ihUInt32 *NA*
    ihUInt16 *NA*
    ihBool *NA*
    For example, if the ODBC server contains a Float data type named ID, enter <ihFloat>ID</ihFloat>
    <DataTypeMapping>
    		<ihDataTypeUndefined>*NA*</ihDataTypeUndefined>
    		<ihScaled>*NA*</ihScaled>
    		<ihFloat>ID</ihFloat>
    		<ihDoubleFloat>*NA*</ihDoubleFloat>
    		<ihInteger>2</ihInteger>
    		<ihDoubleInteger>*NA*</ihDoubleInteger>
    		<ihFixedString>*NA*</ihFixedString>
    		<ihVariableString>3</ihVariableString>
    		<ihBlob>*NA*</ihBlob>
    		<ihTime>*NA*</ihTime>
    		<ihInt64>*NA*</ihInt64>
    		<ihUInt64>*NA*</ihUInt64>
    		<ihUInt32>*NA*</ihUInt32>
    		<ihUInt16>*NA*</ihUInt16>
    		<ihByte>*NA*</ihByte>
    		<ihBool>*NA*</ihBool>
    		<ihMultiField>*NA*</ihMultiField>
    		<ihArray>*NA*</ihArray>
    	</DataTypeMapping>
  3. In the Quality and SubQuality elements, provide the range of values retrieved from the quality column. For quality elements that are not applicable, enter *NA*.
    For example, if the values from 0 to 97 are considered as bad quality, and if the numbers from 98 to 100 are considered as good quality, provide the values as follows:
    <Quality>
    	<ihOPCBad>[0,98)</ihOPCBad>
    		<ihOPCUncertain>*NA*</ihOPCUncertain>
    		<ihOPCNA>*NA*</ihOPCNA>
    		<ihOPCGood>[99,101)</ihOPCGood>
    	</Quality>
    	
    	<SubQuality>
    	<ihOPCNonspecific>*NA*</ihOPCNonspecific>
    		<ihOPCConfigurationError>*NA*</ihOPCConfigurationError>
    		<ihOPCNotConnected>*NA*</ihOPCNotConnected>
    		<ihOPCDeviceFailure>*NA*</ihOPCDeviceFailure>
    			<ihOPCSensorFailure>*NA*</ihOPCSensorFailure>
    		<ihOPCCommFailure>*NA*</ihOPCCommFailure>
    		<ihOPCOutOfService>float</ihOPCOutOfService>
    		<ihScaledOutOfRange>*NA*</ihScaledOutOfRange>
    			<ihOffLine>*NA*</ihOffLine>
    		<ihNoValue>*NA*</ihNoValue>
    		<ihCalculationError>*NA*</ihCalculationError>
    		<ihConditionCollectionHalted>*NA*</ihConditionCollectionHalted>
    		<ihCalculationTimeout>*NA*</ihCalculationTimeout>
    	</SubQuality>
  4. In the TagInfo element, provide the tag details, which are used to browse for tags. Provide the column names available in the ODBC server in the corresponding tag element.
    <TagInfo>
    	<DBName>DB1</DBName> <!--Cannot be *NA*-->
    	<TableName>Temperature</TableName> <!--Cannot be *NA*-->
    	<TagName>Boiler_Temp</TagName> <!--Cannot be *NA*-->
    	<Description>*NA*</Description>
    	<EngineeringUnits>*NA*</EngineeringUnits>
    	<DataType>*NA*</DataType>
    	<MinimumEngineeringUnit>*NA*</MinimumEngineeringUnit>
    	<MaximumEngineeringUnit>*NA*</MaximumEngineeringUnit>
    </TagInfo>
    Note: If you enter *NA* for the DataType element, you can provide only one data type mapping for the DataTypeMapping element and all the remaining elements must be marked *NA*
    You can choose to automatically run queries from the info you provide in the TagInfo element. To do so, enter <Mode>1<Mode> in the TagInfo element. If you want to provide queries manually, enter <Mode>0<Mode> in the TagInfo element.
  5. In the DataInfo element, provide the tag data details, which are used to create a query to collect the data.
    <DataInfo>
    	<DBName>DB1</DBName> <!--Cannot be *NA*-->
    	<TableName>Temperature</TableName> <!--Cannot be *NA*-->
    	<TagName>Boiler_Temperature</TagName> <!--Cannot be *NA*-->
    	<Timestamp>10-06-26 02:31:29,573</Timestamp> <!--Cannot be *NA*-->
    	<Value>97</Value> <!--Cannot be *NA*-->
    	<Quality>good</Quality> <!--Cannot be *NA*-->
    	<SubQuality>*NA*</SubQuality>
    </DataInfo> 
    You can choose to automatically run queries from the info you provide in the DataInfo element. To do so, enter <Mode>1<Mode> in the DataInfo element. If you want to provide queries manually, enter <Mode>0<Mode> in the DataInfo element.
  6. If you want to provide your own queries, provide them in the following format:
    <Query>
        <Browse></Browse>
        <ReadData></ReadData>
        <TagCount></TagCount>
    </Query>
    </Mapping>
    <Query>
    <Browse>SELECT [TagName],[Description],[TagType],[Unit],[MinEU],[MaxEU] FROM [Runtime].[dbo].[TagHistory]</Browse>
    <ReadData>SELECT TagName, [DateTime], Value, Quality, QualityDetail FROM History where History.TagName = '?Tagname?' AND wwRetrievalMode = 'FULL' AND wwVersion = 'Latest' AND DateTime &gt; '?Start?' ORDER BY DateTime ASC</ReadData>
    <TagCount>SELECT count(*) from [Runtime].[dbo].[TagHistory]</TagCount>
    </Query>