> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/datran-browser.md).

# Get started with DATRAN Browser

The DATRAN VI services, the TBD tree in DATRAN Browser, properties, scripts and templates, searching, and diagnostics.

DATRAN Browser is the main configuration tool in the DATRAN VI system and is used to add sites to the system and configure everything about the system and supporting programs. The DATRAN 'Tree Base Database' (TBD) file contains the entire configuration for the DATRAN VI system. It contains everything from the license codes for the services, to the configuration of all the sites on the system to the names and security access codes and pager IDs (numbers) of all the operators on the system.

{% hint style="info" %}
**Applies to:** DATRAN VI. See [DATRAN Supervisor](https://help.qtech.co.nz/datran/datran-vi-scada/datran-supervisor.md).
{% endhint %}

## The DATRAN VI services

There are several services that make up the DATRAN VI SCADA system. However not all of these are used or needed on every base station.

| Service                         | What it does                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tree base server (TBServ)       | At the core of DATRAN is a service called DATRAN Server (TBSERV). This stores the entire configuration for the DATRAN System and the current state of the monitored equipment. The Tree Base server is responsible for co-ordinating the communication of the other services with one another.                                                                                                           |
| Server Manager                  | Periodically saving the contents of DATRAN Server to a TBD (Tree Base Data) file. Monitoring the integrity of the various services. Supplies a heartbeat that can be used to detect failure of DATRAN VI or the computer that it is running on.                                                                                                                                                          |
| Derived Value Generator (DVG)   | This service is responsible for the entire house keeping of nodes and the running of scripts. It also deals with setting up traps, polling and the like within scripts and initialises nodes etc on start up.                                                                                                                                                                                            |
| Alarm Service                   | A service program that provides sophisticated generation and management of alarms and events within the DATRAN Server. This service handles all the alarming nodes within the TBD file and performs all the escalations within alarm classes.                                                                                                                                                            |
| QTech Comms (QComms)            | The QRTU/DATRAN Communications is a Windows service program for the transfer of information to and from QRTU, eXcel, DATRAN and DATRAN II remote telemetry units.                                                                                                                                                                                                                                        |
| Other comms services            | DATRAN Connectivity Modules (DNP3, DF1, Modbus, GE Fanuc).                                                                                                                                                                                                                                                                                                                                               |
| ADO Database Connectivity (ADO) | This service is used by DATRAN to interface with the Microsoft ActiveX Database Object (ADO) communications interface, so that the system can connect to MS Access, MSDE and MS SQL Server databases.                                                                                                                                                                                                    |
| Historical Data Interface (HDI) | This service deals with the set up, retrieval, and logging to the database of remote RTU Data logging functionality.                                                                                                                                                                                                                                                                                     |
| XML Data Interface (XDI)        | The XML Data Interface contains a group of sub services that all use XML as a basis for their communications protocol: the SMS Service (the ability to send and receive text messages from the DATRAN VI system; this functionality requires an Internet connection in order to communicate with DATASHED, our SMS Gateway), the Named Pipe Server (connection with QTech's OPC Server) and Replication. |
| SMS Direct                      | A service that provides the facility for the base station to directly utilise an SMS modem connected to one of its COM ports to send SMS messages to users.                                                                                                                                                                                                                                              |
| TCP Server                      | This service provides efficient access to all of the nodes below Data Root in the TBD file. It is used by DATRANVue (GUI Package) and DATRAN Supervisor (alarm and system management).                                                                                                                                                                                                                   |
| Paging Service                  | It was primarily used to communicate with Telecom's PACNET paging system, but Telecom has discontinued that service. Paging service can still be useful to send email messages, to allow operators to dial into DATRAN and acknowledge alarms via a voice menu system, and to allow ordinary telephones to be dialled and pre-recorded messages to be played when the telephone is answered.             |
| Others                          | DATRAN DDE Server, DATRAN DDE Client, DATRAN OPC Client, Suitelinks, DATRAN InSQL Database Connectivity Module, DATRAN RTU Console, Replication, XML Fetch, TFTP Client, EPL Power Management.                                                                                                                                                                                                           |

![The Applications node in DATRAN Browser, listing the DATRAN services](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FudxiADllrXzTxqONUILF%2Fdatran-browser-applications.png?alt=media)

Using the **Server\Start** or **Server\Stop** menu option from inside DATRAN Browser is the quickest and easiest way to start and stop the DATRAN services. Alternatively you can use the Net Start/Stop commands. For the right order, see [Backup, restart and disaster recovery](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/backup-and-restart.md).

{% hint style="info" %}
DatranService is the name of the user account that is created for all DATRAN Services installed on the computer. If you are not logged in as the same user that the services are logging on as, then you will not be able to see any error messages that may occur when the services start up.
{% endhint %}

## The tree

| Node                             | What's under it                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Computer nodes, one per computer | Each Computer Node represents a computer that is connected to the DATRAN Server; this could be the server itself or a computer that has been connected to the server in the past. The computer node contains information about the volume label of the disk, a list of the services that are installed or have been installed in the past. The security and diagnostics for the services, and the default and global properties of each service. |
| Operators                        | Operators, operator groups and aliases. See [Security, operators and access](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/security.md).                                                                                                                                                                                                                                                                                             |
| Data Root\Channels               | All comms channel configuration should be placed under this node.                                                                                                                                                                                                                                                                                                                                                                                |
| Data Root\Sites                  | This is where all sites and site specific data should be found.                                                                                                                                                                                                                                                                                                                                                                                  |
| Data Root\System                 | All custom scripts which are not found in the system scripts should be found under this node. In addition any other calculation type information should be stored under this node.                                                                                                                                                                                                                                                               |
| System Scripts                   | A read only section of the TBD file used to store system critical scripts that without the system would not function correctly, such as the Station Template and Database Logging Scripts. THESE SHOULD NOT BE ALTERED!                                                                                                                                                                                                                          |

Nodes that are pre and post fixed with an underscore are system nodes, e.g. `_Comms_Object_`. System nodes are managed by an appropriate DATRAN Windows service and can be double clicked to display a user friendly dialog box.

### Recommended layout for sites

* There should be a maximum of four tiers of information, (i.e. no more than four layers of nodes out from the **Sites** node).
* There should never be a node with a value e.g. 'Pump 1 Fault' or 'Site Comms Fail' directly under a Site node. It should always have at least one level of grouping, for example `Sites\Reservoir A\Site\Comms Fail` rather than `Sites\Reservoir A\Comms Fail`.
* While not strictly adhering to this convention, many systems also include an extra level so that sites can be divided into categories. This is also generally acceptable, for example `Sites\Water\Reservoir A\Site\Comms Fail`.

The standards make it easier for all users to make changes to the system, and make use of the Generic scripts which QTech develops. This is because you cannot economically write scripts that work on everybody's system, which means that they are written for a certain format. If the format is too different they may or may not work correctly, or even have damaging results.

### Make changes in DATRAN Browser

Unlock the database by clicking the padlock icon on the toolbar and selecting none.

## Property levels

The DATRAN VI SCADA engine is a highly configurable application, and as such has many changeable properties and setup options. To deal with this there is a hierarchical configuration of the properties, in four different levels of the hierarchy: Local, Grouped, Global and Default. Each level up having precedence to the levels below.

| Level      | Where                                                                      | Example                                                                                                                                                                                                                             |
| ---------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1. Local   | A point on a site within the Sites configuration area of the TBD           | The `Completion RTN` node. This is the local property and has precedence over all other levels. This property is used first if it exists, but does not have to exist.                                                               |
| 2. Grouped | The properties node of an alarm class, for example the 'Sewer' alarm class | The property is being used on a selected group of items (in this case all the 'Sewer' alarms). This property is used in precedence to the Global and Default properties, but does not have to exist.                                |
| 3. Global  | The **Properties** node under the alarm service application                | This property will be used on every alarm class that does not contain a Grouped or Local property. It does not always exist but if it does will take precedence to the Default level property.                                      |
| 4. Default | The **Properties Default** node of the service                             | This is the last rung in the hierarchical ladder and always exists. These values cannot be changed and should not be. Whenever the service in which these properties reside is restarted it will write over the top of any changes. |

Another common example is the Operator fields. The properties under an 'Operator Group' apply to all operators unless there is a local property, which overrides it. The operators Global and Default properties can be found under the Paging application node.

## Formulas, scripts and templates

* **`_Formula_`**: the function of a `_formula_` node, in simple terms, is to evaluate an expression, and to push the result of that expression into the PARENT node of the `_formula_` node. See [Sites, channels and RTUs](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/sites-and-rtus.md).
* **`_Copy_To_`** takes the value of its parent node and pushes it to the designated location in the TBD file. It can also reverse scale the value at the same time, if desired. This is usually done with outputs such as set points or On Off controls.
* **Scripts**: a script is a collection of commands that have been put together to perform a task and are generally written to perform this task on several points throughout the TBD file. A **`_Template_`** is the means by which a script is utilized throughout the TBD file. Every script has an optional parameter called the **Template Key**. This allows the user to call a script by creating a node with the same name as the template key, instead of using a template node. This is the same way the Station Template script is triggered by creating the `_Station_Template_` node.

### Run a script by hand

Scripts will be found, typically, under the `\Data Root\System` folder. Usually a script has been written to operate automatically on the basis of a trigger such as a node value changing. To manually run a script you can right click on the template and select **Apply Template**. This does assume the script has been written to allow manual invocation. This can be checked to see if the script has `OnDo:` at the start of the body of the script that executes.

### Script triggers

| Trigger    | Runs when                                                                                                                                                        |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnStart:` | Causes the statements that follow to be executed when the Derived Value Generator service starts up                                                              |
| `OnDo:`    | Causes the statements that follow to be executed when Template or Command nodes are created, or when the script is applied, but not when the DVG first starts up |
| `OnPoll:`  | Causes the statements that follow to be executed when the template is polled after a poll statement                                                              |
| `OnTrap:`  | Causes the statements that follow to be executed when the template responds to an event trap set up by TrapSingle or TrapMultiple                                |
| `OnUndo:`  | Causes the statements that follow to be executed in reverse order when Template nodes are deleted, or when the script is redefined                               |

If you want to edit a pre existing script, then simply double click on the `_script_` node, or right click on it and select "Edit" from the pop up menu. Right clicking in the editor window will allow you to browse all the available functions and statements to insert them in your script. There is an extensive online help available for most script commands, this can be accessed by clicking on the keyword you want help with and pressing F1. You can also insert node references via the right click menu by browsing the TBD file. There are three buttons that will let you exit the script editor; **Apply Script**, which will save the changes you have made, and then update the system with the new script. **Exit**, which will save your changes to the script, but will not update the system to use the changes until the script is applied, and **Cancel** which will abort any changes you have made and restore the script to the state it was in before you started the editor.

## Search the tree

Note that `...` is the wild card specifier. This can appear at the beginning or end of any pattern. The search commences from the location of the node that you have clicked on. This allows you to narrow your search.

| Field         | What to enter                                                                                                                                                     |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Path Pattern  | The path in the Datran tree structure that you want to search. If you change the Path Pattern to be `...comsfail`, you will reduce the search to only one result. |
| Type Pattern  | Generally you can leave Type Pattern as `...`.                                                                                                                    |
| Value Pattern | The node value you are optionally searching for.                                                                                                                  |
| Limit         | The Limit field defaults to 100. This is the number of search results returned. It can be set to 0 which gives all unlimited results.                             |

The DATRAN Error search lists all nodes in the DATRAN tree that are in an erroneous state.

## Diagnostics

DATRAN Diagnostics is a powerful debugging tool that can be used to see the state of the system and its services and what they are doing. This is invaluable in fault finding. Select **On Screen Categories** from the Diagnostic menu to choose the diagnostics shown on screen, or select **Log To Disk** categories to log them to disk. Once Diagnostics has started press F2: a further dialog box is displayed allowing selection of which diagnostics are required.

There are new diagnostic categories in Datran, for the ADO and HDI, that can show you exactly what SQL is being executed, and the responses from the server, among other things. These will contribute to a significant performance bottleneck when turned on.

The disk logs can be configured for periodic purge and limit size to avoid excessive disk use. In DATRAN Browser double click the Server Manager node and in the resulting dialogue box, in the diagnostic option tab set the "keep for" value to a reasonable period such as 14 days. Set the diagnostic file size to 50 MB or more.
