Object States in DataStudio

All objects in system:inmation have an overall "state" which encompasses different facets of the objects functionality. Is the object functioning correctly? Is the object connected and communicating with other objects in the system? Is the object enabled or disabled?

The full state of each object is recorded in the user state flag group (or bitmask) and can be viewed in the advanced header of the object properties panel in the _State field (more detailed explanation of the user state flag group and the different section meanings can be found in the System Documentation).

To gain an immediate and more visual overview, DataStudio employs a simple visual traffic light system in the model panels, allowing the user to quickly assess the overall state of the system or the state of individual objects.

I/O Model and KPI Model Object States
Figure 1. Object States in I/O Model and KPI Model

The light by the side of each object gives a simple indication of the state of the object.

  • Green = good icon good 32

  • Yellow = warning icon warning 32

  • Red = error icon bad 32

  • Grey = neutral icon neutral 32

Objects with in green "good" state can be assumed to be functioning correctly. Objects in an "error" or "warning" state can be further investigated by checking the Object Properties panel or opening a Log Display to check for errors.

Communication State - Objects with 2 Lights

Some objects in the models have 2 lights to indicate their state. For these objects, the first light (top light) is the overall object state as described above. The second light (the bottom light) gives an indication of the communication state of the object.

In the I/O Model the Core, Connector and Datasource objects have 2 state lights. If either of the lights is in a Warning, Bad or Neutral state, there are some possible explanations.

Here are some examples:

Table 1. Examples of Warning and Bad Object States
Object User State Communication State Possible Reason

System

icon warning 32

N/A

Problem with connection to one or more of the MongoDB Data Stores. Check Log Display to view further error details.

Core

icon warning 32

icon good 32

Core Store and Forward Buffer is full, check Task Manager to see memory loads of Core and MongoDB services.

Connector

icon neutral 32

icon bad 32

Connector service is down, check to see if the Connector service is running on its host machine. Check Log Display to view further error details.

Datasource

icon bad 32

icon warning 32

Datasource configuration is not correct. Depending on the type of Datasource, there could be an error in the connection parameters or the Server may be experiencing downtime. Check Log Display to view further error details.

Datasource

icon bad 32

icon bad 32

Datasource is not online. Depending on the type of Datasource, this could mean that the Datasource service (an OPC Server for example) is not running or is experiencing downtime. Check to see if any relevant services associated with the Datasource are running. Check Log Display to view further error details

Using Lua to access object and communication state

The Lua API can be used to access the object and communication states by using some of the available Object Methods that retrieve the user state flag group directly.

For example, functions can be created that read the object user and communication state flags for objects.

Firstly the state flag:

local function objstate(obj)
ostate = ""
	if obj:empty() == true then
		ostate = "empty"
	end
	if obj:neutral() == true then
		ostate = "neutral"
	end
	if obj:good() == true then
		ostate = "good"
	end
	if obj:warning() == true then
		ostate = "warning"
	end
	if obj:error() == true then
		ostate = "error"
	end
	if obj:unconfirmed() == true then
		ostate = "unconfirmed"
	end

return ostate
end

And secondly, the communication state flag:

local function commstate(obj)
cstate = ""
	if obj:comm_good() == true then
		cstate = "good"
	end
	if obj:comm_empty() == true then
		cstate = "empty"
	end
	if obj:comm_neutral() == true then
		cstate = "neutral"
	end
	if obj:comm_warning() == true then
		cstate = "warning"
	end
	if obj:comm_error() == true then
		cstate = "error"
	end

return cstate
end

These can be called together to return the object (top light) and communication state (bottom light) for a designated object.

local obj = syslib.getobject("/System/Core/Connector")

return [[Comm state of ]] .. obj.ObjectName .. " is: " .. commstate(obj) .. [[

Object state of ]] .. obj.ObjectName .. " is: " .. objstate(obj)

The script will return the information about the object and communication states of the object.

Output of Object and Communication State Lua Script
Figure 2. Output of Object and Communication State Lua Script