When data arrives from IoT devices, it's immediately stored, and then processed.

Storing raw data may be enough for some applications. But usually, additional processing is needed.

Why process IoT data?

In some cases, IoT data needs to be put through a simple calculation, such as a multiplier, or a unit conversion (e.g. the sensor may send a temperature in Fahrenheit, but you want to record Celsius).

In many situations, more complex processing is needed. For example, the latest data may need to be compared to historic data, so as to plot trends, remove noise, or detect alarm conditions.

There are myriad ways in which you may wish to calculate data. So to make Assetwolf as flexible and as scalable as possible, we embedded the Phi IoT scripting language to let you code the exact algorithm that you need.

What is Phi?

Phi is a simple-to-use language. Phi scripts are defined when you edit the Schema of an asset.

Phi is executed every time some data arrives. The script looks at incoming values, performs the calculations, and saves the calculated data. These calculated data are then available on future calculations performed on that asset, and for inclusion into calculations of other assets (for example, to calculated means or plot trends).

Among Phi's key features, are the ability to look at data from:

  • the asset itself, and its latest-received data
  • the asset's historical data
  • the latest data of other assets.

Phi looks like a regular programming or scripting language. There are scientific mathematical operators, and logic such as for-loops (with break and continue), and if-then-else.

Processing data from multiple assets

Data pools are a mechanism for relating assets in a hierarchical way. A data pool can contain a number of assets, or can contain other data pools.

Whenever data arrives and is processed for an asset that's in a data pool, it "bubbles up", thereby updating the data pool it's in, and any data pools above that one, and so on.

When Phi is used on a data pool, a wider range of data sources is available:

  • current up-coming data from any assets in the data pool
  • archived data from the data pool.

How to try it

If you've not tried an Assetwolf portal, try one now

Have a look at the Schema - the generic definition - of an asset. You will see a Phi logic editing box, into which you can type your Phi code. For more help, check our Learn Phi section.