SentinelSCADA › Tutorial › Chapter 4

Chapter 4: WorldSystem and Clocks

Goal Add the WorldSystem driver, then use a Clock widget as a real-time clock in any time zone, and as a count up or count down timer, while learning why the Tag data type matters.

SentinelSCADA includes a comprehensive MODBUS/TCP driver for the most common connection to many PLCs and similar hardware I/O devices, and a MODBUS Simulator with a pre-selection of automated and user set values for immediate testing of your screen widgets. It also includes an IEC 61131-3 Ed.2 Structured Text logic engine in the form of the included AstroPLC, with which you can perform any logic, calculation or other PLC type functionality. And finally, for hardware abstraction of server PC values such as Date, Time, Calendar, CPU Load and other such values, there is the WorldSystem driver.

What combination of drivers you choose is entirely up to your project needs. If you want to display the server's Date or Day of Week, or drive a Clock widget from the real time, then WorldSystem is for you. (A Clock widget used as a timer needs only a numeric tag, from any driver.)

This chapter details the process of setting that up, and points out the importance of using the correct Tag data types in different scenarios.

Part 1: Add the WorldSystem driver

We return to our BoilerHouse project as a reference.

  1. Open Device/Tag Setup

    From the System menu choose Device/Tag Setup…, then in the dialog that follows press + Add Device.

    The Device/Tag Setup dialog with the Add Device button
  2. Choose WorldSystem

    In the DRIVER TYPE drop down select WorldSystem.

    The DRIVER TYPE drop down with WorldSystem chosen

    Once an internal driver such as WorldSystem has been added it cannot be added again. External drivers, such as MODBUS TCP, can be added as many times as your licence permits.

    Note An OPC UA driver is on the horizon, and will be fully included once it becomes available.
  3. Name it and keep the starter tags

    The dialog adapts to the driver type. Give the new driver a useful Name, and be sure to leave ADD EXAMPLE STARTER TAGS ticked. This is important.

    The WorldSystem device named World with Add Example Starter Tags ticked
  4. Save the device

    Press Save Device. A message confirms that the starter tags have been added.

    The confirmation that the example starter tags were added

    If you scroll down in the lower Tags section you will see the new tags appended.

    The new WorldSystem tags, including DateTime.Local and DayOfWeek, highlighted in the Tags list
Mind the tag type Take a moment to look at the type shown in square brackets after each tag. DateTime.Local and DayOfWeek are [String] tags: text, ready formatted for display. They are ideal for a Data Label widget, but a Clock widget cannot use them. A Clock needs a plain number, and for that we have the UnixEpoch tag, which we meet shortly. Choosing the right tag data type for the job is a theme you will meet again and again in SentinelSCADA.

For a full list of the WorldSystem tags, see the World System Driver topic in the built-in help.

Press Close & Reload SCADA Engine to restart the driver system and make all tags available. There is a confirmation pop-up.

The message confirming the SCADA engine was reconfigured

Part 2: Add a Clock widget

From the Toolbox, expand the Display & Data section, then select the Clock and drag it onto the screen. (It is dropped on top of the gauge here, but we will move it afterwards.)

A Clock widget dragged onto the screen, on top of the gauge

The Clock widget has various settings and functionality beyond a simple clock face.

You will notice that, without any configuration, it should already be displaying your local time. This is the first fall back: in the absence of any other setting, just use the local time, which might be all you need. The same fall back applies to the Time Zone setting, as we shall see.

Move the clock to the top right of the screen and select it. Let's look at its properties, which will also show us generally how widget properties are arranged.

The Properties Panel for a new Clock widget, showing Identification and Binding with Data Tag Bind set to None

Part 3: Bind the clock to UnixEpoch

The clock needs a numeric value for its data source, whether you use it as a traditional clock or as a timer display. The value must be a number representing seconds.

When using it as a regular clock, that value should be the UnixEpoch: the number of seconds since 00:00:00 UTC on Thursday, 1 January 1970. The relevance is that, no matter what time zone you may be representing, that value is the same, on this day, at this moment, everywhere. That in turn makes it easy for us to apply a time zone.

For example, say you want a screen that looks like the traditional three clocks showing the time in New York, London and Tokyo. Add three clocks, bind them all to UnixEpoch, set the three different time zones, and you are done.

A world map with three analogue clocks labelled New York, London and Tokyo
A sample screen, not part of our BoilerHouse project, but built from exactly these steps.

Firstly then, select UnixEpoch from our WorldSystem driver as the bound tag.

Data Tag Bind set to UnixEpoch (WorldSystem:14)

Part 4: Set a time zone

Next, assuming we want to set a specific time zone, expand the Geometry & Limits section and find the TIME ZONE (IANA) textbox. Here we put a specific location, using a place name rather than abbreviations such as EST or BST. For example America/New_York, Europe/London and Asia/Tokyo. A valid example looks like this:

The Time Zone box containing Europe/London

If the textbox is left blank, the clock uses the local time of the browser it is displayed in: the fall back again.

Info For a master list of locations visit the Internet Assigned Numbers Authority (IANA) Time Zone Database page.

If, by chance, you enter an invalid location, for example Arizona/Tombstone, you are cautioned with an exclamation mark on the clock itself.

A clock showing a red exclamation mark, with the invalid time zone Arizona/Tombstone in the Properties Panel

Part 5: Display modes and timer mode

The clock widget has two display modes: clock face Analogue, and LED style Digital. Simply select the DISPLAY MODE you need.

When the clock's data tag is a PLC integer, the clock can act as a count down or count up timer display. For this, any numeric tag that counts seconds will do: for example, a UserWord register from the Modbus Simulator, as used here, or a register your PLC logic increments once a second.

A digital clock showing 00:00:20, with Show Seconds and Timer Mode Display ticked

Normally we need to tick Show Seconds and Timer Mode Display as a minimum for this effect.

Timer Mode If you do not set Timer Mode Display, an offset is added (one hour for London, because the UK was on British Standard Time all year round in 1970, the epoch's year), as the clock still thinks it is referring to a time zone. You can also defeat this by setting the time zone to UTC. With Timer Mode Display set, the TIME ZONE setting is simply ignored and the value is shown as a plain count of seconds.

The Show Numerals and Show AM/PM options are for analogue clocks. 7-Segment Style and Ghost Unlit Segments are for digital displays.

The Digital display options: Show Numerals, Show AM/PM, 7-Segment Style and Ghost Unlit Segments

As with most widgets, the Styling & Appearance section offers a multitude of customisation settings for titles, locations, fonts, sizes and colours.

The Styling and Appearance section of the Clock properties
Save the screen Whenever there are changes to a screen, the orange dot, which we met in the last chapter, is there to remind us to use File > Save Screen.
The screen status pill with an orange dot showing the screen needs saving

For the most part the system will try to help us not to accidentally leave a screen with unsaved changes, but good practice helps too.

Summary

In this chapter we discovered the Clock widget and its display modes, attaching it to a valid tag, and setting a specific time zone using the IANA method. In the next chapter we will be discovering Project Properties, UI themes and setting Screen defaults.