XML configuration file

The TwinCAT DataBase Server is configured via an XML configuration file.
The settings of the configuration file are read once when the TwinCAT Database Server is started. Reading of the configuration can also be triggered from the PLC via a function block during TwinCAT DataBase Server runtime.

The configuration contains several sections:

<?xml version="1.0" ?>
<Configuration>
   <Log>1</Log>
   <LogPath>C:\TwinCAT\TcDatabaseSrv</LogPath>
   <StartUp>Manual</StartUp>
   <PwdInfos>tZuYPxhe+G5NKHWLYSZE+NiFAINdlcBgtIUVD+j076ID3geO7FdGzvdfPl0Q09Zb2CKpwj=</PwdInfos>
   <Databases>
      <Database Type="Mobile-Server" ValueType="Double">
         <DBId>1</DBId>
         <DBServer/>
         <DBProvider/>
         <DBUrl>C:\TwinCAT\TcDatabaseSrv\Samples\TestDB_CompactSQL.sdf</DBUrl>
         <DBSystemDB/>
         <DBUserId/>
         <DBTable>myTable</DBTable>
      </Database>
   </Databases>
   <AdsDevices>
      <AdsDevice>
         <AdsId>1</AdsId>
         <NetID>10.1.128.49.1.1</NetID>
         <Port>801</Port>
         <Timeout>2000</Timeout>
         <ADSReadWriteSetting>1</ADSReadWriteSetting>
      </AdsDevice>
   </AdsDevices>
   <SymbolGroups>
      <SymbolGroup>
         <Direction RingBuffMode="Count">ADS_to_DB_RINGBUFFER</Direction>
         <RingBuffCount>20</RingBuffCount>
         <CycleTime>30000</CycleTime>
         <AdsId>1</AdsId>
         <DBId>1</DBId>
         <Symbols>
            <Symbol>
               <DBName>TESTVAR123</DBName>
               <Name>MAIN.TESTVAR123</Name>
               <Type>LREAL</Type>
               <IGroup>16448</IGroup>
               <IOffset>172536</IOffset>
               <BitSize>64</BitSize>
               <DBLogMode>3</DBLogMode>
            </Symbol>
         </Symbols>
      </SymbolGroup>
  </SymbolGroups>
</Configuration>

Notes regarding the XML configuration file:

- Tag „Log“:

Additional option: You can activate the error log mode for tests, to log occurred error descriptions into a text file "TcDBSrvErrorlog.txt".

- Tag „LogPath“:

Additional option: For tests it is possible to activate the error log mode see tag "Log". The path of the text file is declared in this tag.

- Tag „Impersonate“:

Additional option: To activate the "Impersonate" - option you have to add this tag.

- "StartUp" tag:

Start mode setting.
"Autostart" option    : The server starts immediately with tasks specified in the configuration file (e.g. writing of ADS data into the database).
"Manual" option       : The server initially remains passive and is triggered via the "FB_DBCyclicRdWrt" function block.

- "PwdInfos" tag:

Contains all passwords which are needed for the communication with the databases. All passwords are crypted and consequently nonreadable.

- "Databases" tag:

Configuration of the individual databases:

DBId                             each database is allocated a unique ID.
Database Type          At present, "Mobile Server", "ASCII", "Access" and "Sequal Server" database types are supported.
ValueType                 Two storage methods are supported
                                                - "Double" : Saves all the variable values as double values (structures and strings are not supported here);
                                                - "Bytes" : Saves all the variable values as byte streams (structures and strings can also be logged in this way)

- "AdsDevices" tag:

Declaration of ADS devices.

Each runtime system is assigned a unique ID.

The ADS devices are identified through NetID, port and timeout.

"SymbolGoups" tag:

Definition of symbol groups: Specifies which database is linked with which ADS device. In addition the direction of the data flow is specified (from the TwinCAT system to the database or from the database to the TwinCAT system).

The cycle time determines at which intervals data are read from the database or written to the database.

- "Symbol" tag:

Definition of the individual symbols with the following parameters
DBName                              => Symbol name used in the database
Name                                    => Symbol name used in the PLC
Optional: Type                     => Data type of the symbol
Optional: IGroup / IOffset   => Storage location of the symbol
Optional: BitSize                 => Size of the symbol
DBLogMode                        => Optional: Specifies whether the symbols are checked cyclically or after a change.

The configuration file can be found under "C:\TwinCAT\Boot\CurrentConfigDatabase.xml" or, in embedded systems, under "\Hard Disk\TwinCAT\Boot\CurrentConfigDatabase.xml"