Configuration
Configuration Using HAKOM.Config
In case the standard installation procedure is used, the HAKOM.Config is deployed to the local binary folder. Alternatively it is also possible to use a central HAKOM.Config file located on a network drive. In order to use a central HAKOM.Config, the following details must be entered in the local HAKOM.Config.
<HAKOMConfiguration>
<ConfigLocation Type="Path" Location\\networkdrive\product\HAKOM-TSM " />
</HAKOMConfiguration>
The HAKOM.Config provided by the installation contains the minimum configuration required to run the TSM App. There are many additional settings available to customise the behaviour of the TSM App, which are described here and the subsequent pages.
The HAKOM.Config is an XML file, structured hierarchically and is divided into two main parts:
Database connections: <dbconnections>
Products: <products>
<HAKOMConfiguration>
<dbconnections>
<!-- Configuration of database connections-->
</dbconnections>
<products>
<!-- Settings for specific products-->
</products>
</HAKOMConfiguration>
Database Connections
On this level database connections may be configured.
The individual database connections are listed hierarchically under the tag "<dbconnections>. The name of a database connection may be chosen freely.
<cnn> contains the connection string, depending on the database
<password> the password can be entered unencrypted. In that case, it is encrypted the first time the application is used and saved in the HAKOM.config.
Below you can find examples for all supported databases:
<HAKOMConfiguration>
<dbconnections>
<OracleManaged>
<cnn>User ID=TSM;Data Source=TEST;Persist Security Info=False;Min Pool Size=0;Schema=TSM</cnn>
<password>XpwYr2garEE=</password>
<provider>HAKOMOracleManaged</provider>
</OracleManaged>
<SQLServer>
<cnn>User ID=TSM;Data Source=TEST;Integrated Security=false;Initial Catalog=TSM;Min Pool Size=0;MultipleActiveResultSets=True;CommandTimeout=30</cnn>
<password>XpwYr2garEE=</password>
<provider>SQLDBClient2008</provider>
</SQLServer>
<PostgreSQL>
<cnn>Server=TEST;Port=5432;Database=TSM;User Id=TSM;Pooling=true;Command Timeout=30</cnn>
<password>XpwYr2garEE=</password>
<provider>HAKOMPostgreSQL</provider>
</PostgreSQL>
</dbconnections>
</HAKOMConfiguration>
Command Timeout for SQL Server
For SQL Server connection strings it is possible to configure a "CommandTimeout" in order to limit the runtime of individual database queries. An example can be found above.
If this setting is not configured, the default value will limit the runtime of queries to 30 seconds.
Connection Pooling
For all three database types, connection pooling should be activated to achieve optimal performance. By default it is activated for Oracle, SQL Server and PostgreSQL.
Products
Settings regarding different HAKOM products can be configured in this section. Generals settings for the HAKOM Framework are descripted in the following section.
Specific settings for other applications and plug-ins can be found on the pages listed below.
HAKOM TSM App: TSM APP - Configuration
HAKOM WebTSM Servies WebTSM Services Configuration
Timeseries plug-in: Configuration: Timeseries plug-in
Master data import/export plug-in: Configuration: Master data import/export plug-in
Automation plug-in: Configuration: Automation PlugIn
HAKOM Framework
In the following table all available general settings for the HAKOM TSM are descripted.
They are located under following base path in the XML structure of HAKOM.config: //HAKOMConfiguration/products/HAKOMFramework/settings
Tag | Description | Default Value | Possible Values | ||||||
---|---|---|---|---|---|---|---|---|---|
<AssemblyCache> | Path to the Assembly Cache. | "HAKOM Framework Assembly Cache"- File in the machines temp-file. | |||||||
<MaxDegreeOfParallelism> | Controls how many "processes" run parallel when reading or writing data. | 10 | |||||||
<EditTimeSeriesID> | Controls if it is possible to manually set time series IDs. | false |
| ||||||
<EvalComponentPath> | If a path is provided, the EvalComponent files will be retrieved from this path; otherwise the default path is used. |
| |||||||
<CompileWarningProtocolConnName> | Configures a database connection, where the warnings of compilation of formula time series will be written. If no database is provided no protocol will be created. | ||||||||
<ProtocolConnectionForUnhandledExceptions> | Configures a database connection, where logs regarding unhandled exceptions will be logged to. If no connection is provided, no protocol will be created. This setting only affects the GUI. | ||||||||
<CompileWarningProtocolPath> | Configures a path, where the warnings of compilation of formula time series will be written. If no path is provided no protocol will be created. | ||||||||
<MaxNumberOfDataItems> | Sets the maximum number of data items an operation may return. The following sub-settings may be configured:
| 500.000 (For both settings) | |||||||
<QuotationDefaultBehavior> | This setting controls the default behavior if no quotation date is provided when reading a quotation time series. This setting can be overridden for individual time series by setting its respective property to the desired value (during master data import or in the master data view in the Time Series plug-in). It is also possible to modify this setting later on. | 1 |
| ||||||
<SqlLikeEscapeCharacter> | Controls which character can be used to escape special characters ("%", "_") in search strings. | \ | |||||||
<DefaultDataTables> | Allows for default names of data tables for various time series types. The following sub-settings may be configured:
| ||||||||
<ShiftManuallyReplacedPriority> | Changes the valence of the flags "valid" and "manually replaced". | false |
| ||||||
<InternalTimeUnit> | Controls which unit is used to handle time. | 0 |
| ||||||
<DecimalPrecision> | Increases accuracy when saving/reading time series data with minimal loss of performance. | true |
| ||||||
<MaxDbConnections> | Limits the number of allowed concurrent database connections. | 2147483647 (unlimited) |
Assembly Cache
The assembly cache can be activated to accelerate the evaluation of formula time series.
The functions in the EvalComponent*.vb files are compiled into a temporary DLL at every function call. To save the required time for this process, the following entry can be added to HAKOM.Config.
<HAKOMConfiguration>
<products>
<HAKOMFramework>
<settings>
<AssemblyCache>%ALLUSERSPROFILE%\HAKOM\TSM\AssemblyCache</AssemblyCache>
</settings>
</HAKOMFramework>
</products>
</HAKOMConfiguration>
The created DLL files are then stored in the configured location and reused until one of the EvalComponent files or the formula itself is changed.
Support of Milliseconds
To activate time series with intervals less than one second, in HAKOM.config the setting InternalTimeUnit must be added or adjusted.
<HAKOMConfiguration>
<products>
<HAKOMFramework>
<settings>
<InternalTimeUnit>2</InternalTimeUnit>
</settings>
</HAKOMFramework>
</products>
</HAKOMConfiguration>
Possible values:
0 (default), seconds, beginn: 1972-01-01T00:00:00+01:00
1 seconds, beginn: 1970-01-01T00:00:00Z
2 milliseconds, beginn 1970-01-01T00:00:00Z
If the configuration does not contain this tag, the default value 0 will be used.
In addition, a change must also be made to the database. The database contains the function CA_InternalTimeUnit. It returns a fixed value. This return value must be altered with the numeric representation of the required time unit.
BEGIN
--0: Seconds, HAKOM-Time
--1: Seconds, Epoch-Time
--2: Millisecond, Epoch-Time
RETURN 0;
END;
Configuration Using Environment Variables
It is possible to use environment variables for configuring a service instead of providing a HAKOM.Config file. This is especially useful in containerized environments, for example when using Docker.
Detailed information on environment variables in Docker may be found here: https://docs.docker.com/engine/reference/run/#env-environment-variables
Any setting and even entire sections may be provided as an environment variable. The name of an environment variable must correspond to the location of a setting in the HAKOM.Config file.
<HAKOMConfiguration>
<products>
<WebTSMServices>
<Hosting>
<Url>http://127.0.0.1/</Url>
</Hosting>
</WebTSMServices>
</products>
</HAKOMConfiguration>
This setting can be configured by the environment variable
"HAKOMConfiguration_products_WebTSMServices_Hosting_Url=http://127.0.0.1/"
By assigning XML tags as the value of an environment variable it is possible to set up multiple configurations:
<HAKOMConfiguration>
<products>
<WebTSMServices>
<Authentication>
<IntegratedIdentityProvider>
<ValidClients>
<Client>
<Id>TestClient</Id>
<Secret>Password</Secret>
<User>TestUser</User>
</Client>
<Client>
<Id>TestClient2</Id>
<Secret>Password2</Secret>
<User>TestUser2</User>
</Client>
</ValidClients>
</IntegratedIdentityProvider>
</Authentication>
</WebTSMServices>
</products>
</HAKOMConfiguration>
This configuration may be replaced by the environment variable:
"HAKOMConfiguration_products_WebTSMServices_Authentication_IntegratedIdentityProvider_ValidClients=<Client><Id>TestClient</Id><Secret>Password</Secret><User>TestUser</User></Client><Client><Id>TestClient2</Id><Secret>Password2</Secret><User>TestUser2</User></Client>"
Link to Configuration File Using Environment Variables
In order to refer to a central HAKOM.Config using environment variables, the following variables must be set:
Variable | Value |
---|---|
HAKOMConfiguration_ConfigLocation__Type | Path |
HAKOMConfiguration_ConfigLocation__Location | Specific path of the location of the HAKOM.Config file E.g.: \\networkdrive\product\HAKOM-TSM |