ODBC Data Collector Mapping

Mapping is the process of associating the data format and structure of the source and with the corresponding data format of the collector to be able to interpret the received the data accurately.

Mapping is done using an xml file, ODBC_Mapping.xml. If the ODBC Collector is installed in C drive, the Mapping file path will be stored as

<C:\Program Files\GE Digital\Historian ODBC Collector\Server\ODBC_Mapping.xml>

in the MappingFile variable of ODBC Collector registry path. The Mapping file is shipped with the installer. This section explains the parameters of the file in detail.

<Mapping>

DataTypeMapping is used to match the historian data types with corresponding ODBC source data types. The data types which does not have any mapping in ODBC source should be added as "*NA*".

For Example: If the source contains data type named "Test" which is of Float type, then Test would be mapped to ihfloat.

<DataTypeMapping>
		<ihDataTypeUndefined>*NA*</ihDataTypeUndefined>
		<ihScaled>*NA*</ihScaled>
		<ihFloat>1</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>

Quality and SubQuality tag elements are used to provide the range of values, retrieved from quality column, to be considered for intepreting the quality.

For Example: If the values from 0 to 97 has to be considered as a bad quality and from 99 to 100 has be to considered as the good quality then the Quality tag should be as follows.
Note: Not applicable quality elements should be marked as "*NA*"
<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>

Mapping file can automatically frame the queries from the provided input in the TagInfo and DataInfo tags. In addition, User is provided with flexibility to disable this feature and provide the manual queries

To enable Manual mode: Mode value should be "0"

To enable auto mode: Mode value should be "1", which is by default.

<Mode>0</Mode>
Taginfo is used to map the tag details, which are used to browse the tags. The column names present in the source database should be provided in the corresponding tag element so that collector would use this information to frame the query.
<TagInfo>
		<DBName>*NA*</DBName> <!--Cannot be *NA*-->
		<TableName>*NA*</TableName> <!--Cannot be *NA*-->
		<TagName>Test</TagName> <!--Cannot be *NA*-->
		<Description>*NA*</Description> <!--If not applicable mark it as "*NA*"-->
		<EngineeringUnits>*NA*</EngineeringUnits> <!--If not applicable mark it as "*NA*"-->
		<DataType>*NA*</DataType>    <!--If not applicable mark it as "*NA*", However, when DataType is *NA*, Only one data type mapping can be done in <DataTypeMapping> section and all the rest shall be marked as *NA*-->
		<MinimumEngineeringUnit>*NA*</MinimumEngineeringUnit><!--If not applicable mark it as "*NA*"-->
		<MaximumEngineeringUnit>*NA*</MaximumEngineeringUnit><!--If not applicable mark it as "*NA*"-->
	</TagInfo>

DataInfo is used to get the data and the column names present in the source database should be provided in the corresponding tag element so that collector would use this information to frame the query.

<DataInfo>
		<DBName>*NA*</DBName> <!--Cannot be *NA*-->
		<TableName>*NA*</TableName> <!--Cannot be *NA*-->
		<TagName>Test</TagName> <!--Cannot be *NA*-->
		<Timestamp>*NA*</Timestamp> <!--Cannot be *NA*-->
		<Value>*NA*</Value> <!--Cannot be *NA*-->
		<Quality>*NA*</Quality> <!--Cannot be *NA*-->
		<SubQuality>*NA*</SubQuality> <!--If not applicable mark it as "*NA*"-->
	</DataInfo> 

The queries framed by the collector would be reflected in the below Tag.

If the manual mode has been selected, User must provide the query in the corresponding elements.

If Auto mode is enabled, Collector would automatically generate the query and fills the below elements for further reference.

All the following files are mandatory and "*NA*" cannot be used here.

<Query>
    <Browse></Browse>
    <ReadData></ReadData>
    <TagCount></TagCount>
</Query>
</Mapping>
Example:
<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>