Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

Configuration Manager Setup

  • Last UpdatedOct 28, 2024
  • 4 minute read

The Configuration Database must first be set up in the Admin module, set up is then required in the Lexicon module.

Configuration Manager Setup in the Admin Module

There must be at least one DataBase (DB) of type Configuration in the Multiple DataBase (MDB). By default, a Config DB already exists which is a read only type with Core configurations. It is not recommended to use the default Config DB.

A config DB is created in the same way as any other DB and can be added to the MDB.

Once the Config DB is set, config sets must be created using the Command Window.

Note:
The commands do not produce any visible results in the Admin Explorer.

The example PML code can be used as a reference to create a Config Set World as well as Config Sets below it.

goto frstw CONF

$* Sets

$P Creating config set world

new CFGSTW /EICONFIGWORLD

$P Creating config sets

new CFGSET /EICONFIGSET

Dname 'AVEVA EI options'

Desc 'AVEVA EI options'

Precedence 1

The example Programmable Macro Language (PML) code creates a Config Set World named EICONFIGWORLD and creates a Config Set named EICONFIGSET below it. Appropriate PML may be required to navigate to the right node Config DBs in the MDB or multiple Config Worlds already exist in the DB. The precedence value indicates the order in which the Config Sets must be considered, the higher the precedence value the higher the priority of the Config Set. It is not recommended to use precedence values above 3000 as some Core configurations make use of values above 3000.

Configuration Manager Setup in the Lexicon Module

The keys that point to the Configuration Manager values saved in the Config DB must be created in the Dictionary DB using the Lexicon module.

Valid Config Group World (CFFGGDW), Config Group (CFGGRP) and Config Key (CFGKEY) elements must be created.

The example can be used as a reference to create and configure a CFFGGDW element.

The example can be used as a reference to create and configure a CFGGRP element.

The CFGGRP must be populated with a Name and a valid Config key name. The Display name is an optional attribute.

The CFGGRP can contain multiple group elements as well as multiple key elements.

The example can be used as a reference to create and configure a CFGKEY element.

The CFGKEY must be populated with a Name, a Config Key name, a Config value type and a Uda type.

Note:
The Config value type must be set to 2 for strings.

Use Configurations

To use configuration, dbProviders must be instantiated appropriately when the module/ add-in, project is loaded.

An instance of IConfigurationManagerConsumer can be created. A configuration manager consumer is used to interact with the configurations and to create dbProviders.

A dbProvider can be created in the following way:

var dbProvider = new DatabaseConfigurationProvider(providerName, displayName, parentGroup, precedence, "Startup", setName, active, set);

The parameters are self explanatory. The dbProvider must be associated with a parent group.

By default, the configuration provider initialises any configurations that are saved under the parent group. The created dbProviders must then be added to the configuration manager:

configurationManager.AddProvider(dbProvider);

Only providers added to the configuration manager are available for use in the project.

Set Configuration Values

Setting a value in a key requires dbProvider. For example:

  dbProvider = null;

    var configurationManager = EIDependencyResolver.ConfigurationManagerConsumer;

    foreach(var provider in configurationManager.Providers)

    {

      if (provider.Name == "EICableSpecProvider")

      {

        dbProvider = provider as DatabaseConfigurationProvider;

      }

    }

    //WRITE

dbProvider.Set(@"EICONFIGURATIONKEY/ELECCABLESPECKEY", specData.Electrical);

The required dbProvider can be queried in various ways from the collection offered by the configuration manager consumer.

The Set method of DatabaseConfigurationProvider uses two arguments – the key name along with the group name and the value to be stored in the key. The value supplied is stored in the key passed to this method.

A configuration value can also be set using the ConfigurationManager. The configuration instance must be registered in one of the providers under ConfigurationManager. The ConfigurationManager does not load a configuration if it has no instances or values saved in it. Setting values using ConfigurationManager requires careful assessment before use.

Get Configuration Values

To get values stored under a key, the key along with the group name must be passed to the get method. For example:

configurationManager.Get<string>(@"EICONFIGURATIONKEY/ELECCABLESPECKEY");

The configuration manager can be used to get a value if a valid config key exists.

In This Topic
TitleResults for “How to create a CRG?”Also Available in