# Build your first 2D screen

> From an empty project to a live operator screen in about 15 minutes - create four tags, draw a tank, a pump and a valve, join them with pipes, bind them, give the pump a command with a confirmation, add a setpoint input, deploy and operate it in the runtime.

Product: eaxScada · Type: Tutorial · Editions: Starter, Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/tutorials/build-your-first-2d-screen/
Verified against commit d283039.

In this tutorial you build a small operator screen for one tank: its level, the pump that fills it, the outlet valve that drains it, the pipes between them, and the setpoint at which the pump stops. At the end the screen runs in the operator runtime with live values, and the pump and valve answer a command after a confirmation.
[Image: The finished screen in the operator runtime: pump P-1 running in green, piped to tank TK-1 at 78 %, the tank piped to outlet valve XV-1, which is closed, and the High setpoint entry at 80 %.]
[Image: The finished screen in the operator runtime: pump P-1 running in green, piped to tank TK-1 at 78 %, the tank piped to outlet valve XV-1, which is closed, and the High setpoint entry at 80 %.]

What you will build: the tank fills while the pump runs, and the pump stops at the high setpoint.
You need no PLC: four local tags and a short script stand in for the plant. Later you replace them with your driver tags or eaxPLC variables, and the screen does not change.

## Before you start

- eaxScada is installed and you can open the Studio (`http://<server>:8080/` on a default installation) as an engineer (Lead_Engineer or Administrator). The first account of a new installation is `admin`.
- Any edition works: Starter, Pro and Enterprise (the badges at the top of the page), and eaxScada Free, the edition without a licence, which has the same 2D designer for evaluation and non-production use. Free runs the runtime in 60-minute sessions, which is enough for this tutorial.
- About 15 minutes.

The other two editors start from the same tags: [Build your first isometric plant map](/docs/eaxscada/tutorials/build-your-first-isometric-plant-map/) and [Build your first 3D scene](/docs/eaxscada/tutorials/build-your-first-3d-scene/). Which one to use when is explained in [Choose an editor: 2D, 3D or isometric](/docs/eaxscada/explanation/choose-an-editor/).

## 1. Create the tags

A fresh installation has only its system tags (`System/...` and the plant emergency-stop signal). Create four local tags (eaxTags), which live in eaxScada itself:

1. In the activity bar on the left, open **Drivers**, then click **Local tags (eaxTags)** in the project explorer.
2. Click **+ Tag**. The **New local tag** dialog opens.
3. Fill in the first tag, click **Save**, and repeat for the others:

   | Path (UNS) | Unit | Range min / max | Initial value | No value until written | Writable by operators | Simulated |
   |---|---|---|---|---|---|---|
   | `Line1/Tank1/Level` | % | 0 / 100 | 0 | on | off | on |
   | `Line1/Tank1/HighSetpoint` | % | 0 / 100 | 80 | off | on | off |
   | `Line1/Pump1/Running` | | 0 / 1 | 0 | off | on | off |
   | `Line1/Valve1/Open` | | 0 / 1 | 0 | off | on | off |

   A new tag starts with **No value until written** ticked and **Simulated** off. Ticking **Writable by operators** clears **No value until written** by itself, so the three writable tags start at their initial value. Tick **Simulated** for the level only.
[Image: The New local tag dialog for Line1/Tank1/HighSetpoint: unit %, initial value 80, range 0 to 100, Writable by operators ticked, which cleared No value until written, Simulated cleared, and the note on the new-tag defaults under the options.]
[Image: The New local tag dialog for Line1/Tank1/HighSetpoint: unit %, initial value 80, range 0 to 100, Writable by operators ticked, which cleared No value until written, Simulated cleared, and the note on the new-tag defaults under the options.]

The high setpoint is writable: an operator may change it from the screen.
**Writable by operators** lets a screen write the tag; a tag without it refuses every write. **Simulated** marks a value as "SIM" everywhere, so nobody takes it for a plant value. **No value until written** keeps the level Bad, "waiting for initial data", until the script below writes it, instead of showing a made-up 0. Every option is described in [eaxTags local tags](/docs/eaxscada/reference/eaxtags-local-tags/#the-new-local-tag-dialog).

Now make the level move. Click **+ Script**, enter the id `tank1_fill`, the name `Tank 1 fill and drain`, `500` ms, and replace the source with:

```js
// Tank 1: the pump fills it, the outlet valve drains it.
var level = 40;

function tick() {
  var running = tags.get("Line1/Pump1/Running") == 1;
  var open = tags.get("Line1/Valve1/Open") == 1;
  var inflow = running ? 4 : 0;   // % per second
  var outflow = open ? 3 : 0;
  level = sim.clamp(level + (inflow - outflow) * dt, 0, 100);
  tags.set("Line1/Tank1/Level", level);
  // the pump stops when the tank reaches its high setpoint
  if (running && level >= tags.get("Line1/Tank1/HighSetpoint")) {
    tags.set("Line1/Pump1/Running", 0);
  }
}
```

Click **Save**. The server checks the script with one dry run and starts it: the list shows it with a green dot and the status says **running**. Every function a script can call is in [eaxTags script reference](/docs/eaxscada/reference/eaxtags-scripts/).
[Image: The Scripts tab of Local tags: the tank1_fill script in the code editor, running every 500 ms with no errors.]
[Image: The Scripts tab of Local tags: the tank1_fill script in the code editor, running every 500 ms with no errors.]

The script runs on the server, whether a screen is open or not.
## 2. Create the screen

1. Open **Screens** (the first icon of the activity bar). The designer opens with the **Displays** panel on the left.
2. Click **New**, then **New Display**.
3. Enter **Display Title / Name** `Tank 1 overview`. The **Display Identifier** fills in by itself; set it to `tank1_overview`, which is the address operators will use.
4. Choose **Resolution Preset** `1280 × 720` and leave the other fields as they are.
5. Click **Create**.
[Image: The New display dialog: name Tank 1 overview, identifier tank1_overview, root folder, Replace display type, 1280 x 720 resolution.]
[Image: The New display dialog: name Tank 1 overview, identifier tank1_overview, root folder, Replace display type, 1280 x 720 resolution.]

The identifier cannot be changed later without changing every link to the screen.
The empty screen opens on the canvas, and the **Displays** tree lists it.

## 3. Place the tank, the pump and the valve

1. Open the **Palette** tab and type `tank` in the search box (**/** puts the cursor there).
2. Click **Storage tank**, then click on the canvas where the tank goes.
3. Do the same with **Pump (mimic)** (search `pump`) and **Valve (mimic)** (search `valve`).
[Image: The Palette searched for "tank": vessels and tanks, with Storage tank among them.]
[Image: The Palette searched for "tank": vessels and tanks, with Storage tank among them.]

The search finds objects by name, by another name and by group.
Select each object and, in the inspector on the right (**Properties** tab), give it a **Component Label**: `TK-1`, `P-1` and `XV-1`. You can also type its **X**, **Y**, **Width** and **Height**. Drag an object to move it; its handles resize it.

Press **Ctrl+S** (or the save button at the right of the toolbar) whenever you want: saving stores the screen in the Studio. Operators do not see it yet.
[Image: The three objects on the canvas: storage tank TK-1, pump P-1 bottom left and valve XV-1 to the right.]
[Image: The three objects on the canvas: storage tank TK-1, pump P-1 bottom left and valve XV-1 to the right.]

The tank, the pump and the valve, labelled.
### Join them with pipes

Draw the pipes from the objects themselves, so they stay attached when you move things later.

1. Select the pump. A blue **+** appears on each of its sides.
2. Drag the **+** on its right side onto the tank. The tank shows its ports as white dots; release when the left one turns green.
   [Image: The + of pump P-1 dragged onto tank TK-1: a dashed pipe route from the pump to the tank's left port, which is highlighted in green, with the tank's other ports shown as white dots.]
   [Image: The + of pump P-1 dragged onto tank TK-1: a dashed pipe route from the pump to the tank's left port, which is highlighted in green, with the tank's other ports shown as white dots.]
3. Select the tank and drag the **+** on its right side onto the valve's left side.

The pipes bend at right angles and go around the objects in their way. Drag the tank somewhere else: both pipes follow it. If a pipe ends on the empty canvas instead of on an object, drag that end (a white circle when the pipe is selected) onto the object.
[Image: The pump joined to the tank's left side and the tank's right side joined to the valve by two blue pipes.]
[Image: The pump joined to the tank's left side and the tank's right side joined to the valve by two blue pipes.]

Each pipe is glued to a port at both ends.
The **Pipe** tool (**P**, in the toolbar and in the palette's **Basic** group) draws the same connector: click the pump, then the tank. Routes, arrows, bends and older pipes are covered in [Connect objects with pipes and lines](/docs/eaxscada/how-to/connect-objects-with-pipes-and-lines/).

## 4. Bind them to the tags

A binding ties one property of an object to a tag.

1. Select the tank and open the inspector's **Bind** tab.
2. **Target Widget Property / Attribute**: **Fluid Level Fill (0 - 100%)**.
3. **Binding Mode**: **Direct ISA-95 Tag Path**.
4. **ISA-95 Tag Path**: `Line1/Tank1/Level` (or click **Pick Tag** and choose it in the tag tree).
5. Click **Apply Expression Binding**. The binding is listed under **Active Bindings**.
[Image: The Bind tab of tank TK-1: Fluid Level Fill bound directly to Line1/Tank1/Level, listed under Active Bindings.]
[Image: The Bind tab of tank TK-1: Fluid Level Fill bound directly to Line1/Tank1/Level, listed under Active Bindings.]

The tank's fill follows the level tag.
Bind the two others the same way:

| Object | Target property | Tag |
|---|---|---|
| P-1 | **Running Boolean (True/False)** | `Line1/Pump1/Running` |
| XV-1 | **Valve State (0=Closed, 1=Open, 2=Fault)** | `Line1/Valve1/Open` |

You can also drag a tag from the **ISA-95 Tag Tree** under the palette onto an object.

## 5. Give the pump and the valve a command

A command writes a tag when the operator presses the object. It always goes through the server's checks, and a confirmation makes the operator say yes first.

1. Select the pump and open the **Action** tab.
2. **Action Type**: **Toggle tag value**. Each press writes the opposite of the live value: start when stopped, stop when running.
3. **Target Tag Path**: `Line1/Pump1/Running`.
4. Under **Confirmation**, choose **Require Confirmation** and write the **Confirmation question**: `Start or stop pump P-1?`
5. Click **Apply Action Configuration**.
[Image: The Action tab of pump P-1: Toggle tag value on Line1/Pump1/Running, Require Confirmation with the question "Start or stop pump P-1?".]
[Image: The Action tab of pump P-1: Toggle tag value on Line1/Pump1/Running, Require Confirmation with the question "Start or stop pump P-1?".]

The confirmation is enforced by the server for every writer of the tag, not only by this screen.
Do the same on the valve with `Line1/Valve1/Open` and the question `Open or close outlet valve XV-1?`.

:::note[Commands are not run in the designer by a tap]
On a touch screen, tapping an object in the designer only selects it: it never sends its command, not even with **Animate** on. Try commands in the [live preview or the runtime](#8-deploy-and-run-it), where the touch protection, the confirmation and the e-signature apply. With a mouse, a click with **Animate** on, **Alt**+click and the Action tab's **Test Action Now** do run the command, through the same confirmation and server checks.
:::

## 6. Make a Bad value obvious with a state style

A state style changes how an object looks in one state. Here, the pump gets a hatched pattern and a red border whenever its tag has Bad quality (a lost connection, for example), so nobody reads a stale "stopped" as true.

1. Select the pump, open the **Properties** tab and scroll to **States**.
2. Click the **Bad quality** chip. The canvas now shows the pump in that state.
3. Set **Border** to `#e11d48`, **Border width** to `3` and **Pattern** to **hatched**.
4. Click **Normal** to go back to the normal look.
[Image: The States section of pump P-1 with the Bad quality chip selected: border #e11d48, width 3, hatched pattern; the canvas shows the pump hatched.]
[Image: The States section of pump P-1 with the Bad quality chip selected: border #e11d48, width 3, hatched pattern; the canvas shows the pump hatched.]

A dot marks the states you changed on this object.
A state style is visual only: whether an object can be operated is decided by its conditions, the user's rights and the server. To give every object of a kind the same look, use **Project state styles...** (see [Style object states](/docs/eaxscada/how-to/style-object-states/)).

## 7. Add the setpoint input

1. In the palette, search `numeric` and place a **Numeric entry** to the right of the tank.
2. In its **Properties** tab, set:

   | Field | Value |
   |---|---|
   | Tag written | `Line1/Tank1/HighSetpoint` |
   | Caption | `High setpoint` |
   | Minimum / Maximum / Step | `10` / `95` / `1` |
   | Decimals / Unit | `0` / `%` |
   | Confirmation | **Confirm (dialog)** |
   | Confirmation message | `Change the high setpoint of TK-1?` |
[Image: The Numeric entry's properties: tag written Line1/Tank1/HighSetpoint, caption High setpoint, minimum 10, maximum 95, step 1, decimals 0.]
[Image: The Numeric entry's properties: tag written Line1/Tank1/HighSetpoint, caption High setpoint, minimum 10, maximum 95, step 1, decimals 0.]

Once the screen is saved, the server refuses 96 or 9.5 from every writer of the tag.
Save the screen (**Ctrl+S**). The limits and the confirmation are enforced by the server from that save on, for every writer of the tag (see [Add setpoint inputs](/docs/eaxscada/how-to/add-setpoint-inputs/)).

## 8. Deploy and run it

First look at the live values in the designer: click **Animate** in the toolbar. The tank fills to the level of the tag (40 % when the script starts). Click **Animate** again to stop.
[Image: The designer with Animate on: the tank shows the live level of Line1/Tank1/Level.]
[Image: The designer with Animate on: the tank shows the live level of Line1/Tank1/Level.]

Animate shows live values in the designer.
Operators only see what you deploy: a new project has **Live editing** off, so saving never changes their screens.

1. Click **Deploy** in the header (it carries the number of changes not yet deployed).
2. The **Deploy Project** dialog shows what is published. A new project requires your electronic signature: you are the signer, and you type your own password.
3. Click **Sign and deploy**. The dialog says **Project deployed** and offers **Open the operator runtime**.
[Image: The Deploy Project dialog: target project, one route, review off, the signer and the meaning of the signature, an empty Password field and Sign and deploy.]
[Image: The Deploy Project dialog: target project, one route, review off, the signer and the meaning of the signature, an empty Password field and Sign and deploy.]

You sign exactly the manifest shown; if the project changes first, you are asked to sign again.
Open the screen in the runtime at `http://<server>:8080/runtime/tank1_overview` (or **Runtime → Live preview** in the Studio, which shows the same runtime inside the Studio).

1. Click the pump. The confirmation asks **Start or stop pump P-1?**. Click **Execute Action**.
   [Image: The runtime's Action Confirmation Required dialog: "Start or stop pump P-1?" with Cancel and Execute Action.]
   [Image: The runtime's Action Confirmation Required dialog: "Start or stop pump P-1?" with Cancel and Execute Action.]
2. The pump turns green and the tank fills. At 80 % the script stops the pump.
3. Click the high setpoint, type `60` and press **Enter**, then confirm. Type `99`: the entry refuses it before anything is sent ("Above the maximum 95").
4. Open the valve: the tank drains.

## What you built

A screen that reads four tags, writes three of them through confirmations the server enforces, and shows a Bad value distinctly, deployed with a signature and running in the operator runtime. On a phone, operators get the same screen as cards: see [Use the operator runtime on a phone](/docs/eaxscada/how-to/use-runtime-on-a-phone/).

To go further:

- Connect real tags instead of the script: [Connect to an S7 PLC](/docs/eaxscada/how-to/connect-to-an-s7-plc/), [Connect to a Logix controller](/docs/eaxscada/how-to/connect-to-a-logix-controller/).
- Edit faster, or on a phone or a tablet: [Edit screens](/docs/eaxscada/how-to/edit-screens/).
- One faceplate for many pumps: [Reusable screens with parameters](/docs/eaxscada/how-to/reusable-screens-with-parameters/), opened as a popup: [Popups, docks and navigation](/docs/eaxscada/how-to/popups-docks-and-navigation/).
- Check before deploying: [Check screens before deploy](/docs/eaxscada/how-to/check-screens-before-deploy/).
- The same tank on a plant map: [Build your first isometric plant map](/docs/eaxscada/tutorials/build-your-first-isometric-plant-map/), or in 3D: [Build your first 3D scene](/docs/eaxscada/tutorials/build-your-first-3d-scene/).
