esi-examples
A library for setting up various examples to demonstrate various features of the system or for showcasing the capabilites of built-in Lua libraries.
The following esi-examples can be installed using this library:
-
DemoData: Creates example data to demonstrate the use of I/O Model, KPI Model and ISA-95 Equipment Model.
-
RemoteMongoDB: Except for the local Data Store for logfiles, all other Data Stores will be redirected to a remote standalone Mongodb server. Only "simple" standalone connections are currently supported: No security settings, no encryption, no replica sets!
-
SendMail: Sends an HTML-formatted test eMail to a given recipient.
-
WeatherData: Fetches live weather data and weather warnings from the German Weather Service and parses the returned html data.
-
BatchTracker: Simulates a bread factory to illustrate various uses of the batch tracker feature.
-
ODBC: Accesses SQL databases with Lua scripts.
-
USAirportData: Another example for HTTP requests, including XML parsing.
-
JSON: Converts JSON data into system objects.
-
OEESimulation: Creates a complete simulation for OEE functionality.
Dependencies
library | version | inmation core library |
---|---|---|
esi-examples-demodata |
0.1.1 |
yes |
esi-examples-mongodb |
0.1.1 |
yes |
esi-examples-smtp |
0.1.1 |
yes |
esi-examples-weatherdata |
0.1.1 |
yes |
esi-examples-batch-tracker |
0.1.1 |
yes |
Available functions
All functions have to be called according to the ESI standard, using colons, e.g.
lib:FUNCTIONNAME(params)
Function | Description |
---|---|
Sets up one or more requested examples |
SETUP
Function head:
lib:SETUP( { {"example", "parameter"} [, {"example2", "parameter2"}, {...} ] } )
Installs the chosen example in a folder named Examples underneath the system core object.
The function expects a multi-dimensional Lua table containing the name of the example(s) to be installed and possible additional parameters.
Available examples:
Example | Paramaters |
---|---|
|
|
— |
|
— |
|
— |
|
— |
|
— |
|
— |
|
— |
|
— |
Valid Lua usages:
local exm = require('esi-examples')
--
-- Populate I/0 Model:
exm:SETUP({{"demodata", "iomodel"}})
--
-- Note that the following options all implicitly create I/O model data if it not already exists!
--
-- Create random historical data for objects in I/O model:
exm:SETUP({{"demodata", "history"}})
--
-- Populate I/O Model and create random historical data in one step:
exm:SETUP({{"demodata", "iomodel", "history"}})
--
-- Populate KPI Model:
exm:SETUP({{"demodata", "kpimodel"}})
--
-- Populate ISA-95 Equipment Model:
exm:SETUP({{"demodata", "isamodel"}})
--
-- Do all of the above in one simple step:
exm:SETUP({{"demodata", "all"}})
--
-- Creates an action itm that reconfigures the local data stores to use a different MongoDB server:
exm:SETUP({{"RemoteMongodb"}})
--
-- Creates an action item that can send HTML formatted eMails:
exm:SETUP({{"SendMail"}})
--
-- Creates a sample folder for live DWD weather data:
exm:SETUP({{"WeatherData"}})
--
-- Creates a sample folder for demonstrating the batch tracker feature.
exm:SETUP({{"BatchTracker"}})
--
-- Creates a sample folder for live US airport data.
exm:SETUP({{"usairportdata"}})
--
-- Creates a sample folder for demonstrating the useage of ODBC.
exm:SETUP({{"odbc"}})
--
-- Creates a sample folder for demonstrating JSON processing.
exm:SETUP({{"json"}})
--
-- Creates all demo data and the sendmail example in one call:
exm:SETUP({{"demodata","all"},{"sendmail"}})
DemoData
Description
This creates various sets of Demo Data for training and testing purposes. Demo data and objects for I/O Model, KPI Model and ISA-95 model, including historical data, can be created.
Installation
local exm = require('esi-examples')
--
-- Populate I/0 Model:
exm:SETUP({{"demodata", "iomodel"}})
--
-- Note that the following options all implicitly create I/O model data if it not already exists!
--
-- Create random historical data for objects in I/O model:
exm:SETUP({{"demodata", "history"}})
--
-- Populate I/O Model and create random historical data in one step:
exm:SETUP({{"demodata", "iomodel", "history"}})
--
-- Populate KPI Model:
exm:SETUP({{"demodata", "kpimodel"}})
--
-- Populate ISA-95 Equipment Model:
exm:SETUP({{"demodata", "isamodel"}})
--
-- Do all of the above in one simple step:
exm:SETUP({{"demodata", "all"}})
RemoteMongoDB
Description
This example provides an Action Item with a Lua script to point local data stores to a different Mongodb instance.
Installation
The example can be loaded from a Console Display in DataStudio with the following simple Lua code:
local exm = require('esi-examples')
exm:SETUP({{"RemoteMongoDB"}})
The code above will create a folder structruce "Examples/Remote Mongodb" underneath the Core object in I/O Model. In this folder will be a single, disabled Action Item named "Repoint Data Stores". This Action Item contains a Lua script body that illustrates how to repoint the several of the standard data stores to a different standalone Mongodb server.
-
Note: Only "simple" standalone connections are supported - no security settings, no encryption, no replica sets!
WeatherData
Description
The Weather Data example uses the esi-lcurl-http-client
library to fetch weather data from the German Weather Service
("DWD - Deutscher Wetterdienst") servers.
This is an official public server and the data is made available in an HTML file that can be downloaded from this URL: https://www.dwd.de/DWD/wetter/aktuell/deutschland/tabelle/wx_brd_akt.html
A Lua script parses this HTML file and then creates objects in I/O model that contain this data.
BatchTracker
Description
In order to illustrate the use of the batch tracker feature, an example use case was chosen to is relatively easy to comprehend for everyone. A bread factory represents a scenario everybody can relate to, and baking simple wheat bread, for example, is something everybody can do in their kitchen at home.
Installation
The example can be loaded from a Console Display in DataStudio with the following simple Lua code:
exm=require("esi-examples")
exm:SETUP({{"batchtracker"}})
The code above will create a folder structruce "Examples/Bread Factory" underneath the Core object in I/O Model, and it will also create an enterprise structure in the ISA95 Equipment Model.
After the initial setup, the simulated bread factory will not be active and its objects in I/O model will appear disabled. To activate the simulation, enable the "00 MES" object:
USAirportData
Description
This example uses the esi-lcurl-http-client
library to fetch data in XML format from an official US government server:
https://soa.smext.faa.gov/asws/api/airport/status/
A Lua script parses the XML file and then creates an object representing the data in I/O model.
ODBC
JSON
OEESimulation
This example provides a quick way to get an impression of the OEE functionality of the system.
Installation
The example can be loaded from a Console Display in Data Studio with the following simple Lua code:
exm=require("esi-examples")
exm:SETUP({{"oeesimulation"}})
The code above will create a folder structure 'Examples/OEE' underneath the Core object in I/O Model. This structure hosts the OEE Simulator Action Item and all objects providing simulated data. In the ISA-95 Equipment Model 'The OEE Demo Enterprise' hierarchy will be added. This is the simulation enterprise with all it’s subsections. The OEE Equipment Monitor and the configuration objects are located in this structure (see below). When the OEE Equipment Monitor is running, the Output Objects for the OEE indices will also be found there, underneath the OEE Equipment Monitor object. In the KPI Model the 'OEE Demo KPI Root Node' is generated.
Using the OEE Simulation
The OEE Simulator Action Item in the I/O Model starts producing simulation data on installation.
To launch the calculation of OEE Indices for this simulation, go to the ISA-95 Equipment Model and select the OEE Equipment Monitor object which is located at …
- The OEE Demo Enterprise - The OEE Demo Site - The OEE Demo Area - The OEE Demo Cell - *The OEE Demo Equipment Monitor*
... and in the Properties Panel go to the Common section. For the Processing Mode property select 'Production' from the drop-down list, then click 'Apply' for the Properties Panel.