Giter Site home page Giter Site logo

made2591 / predix-configurator Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 7.2 MB

A Predix© configurator tool (cli) written in Python + an AngularJS 4 webapp to help you manage your Edge Connectivity stack, from machines in your factory to Predix microservices in your cloud space.

License: GNU General Public License v3.0

Python 1.48% TypeScript 13.42% JavaScript 56.04% HTML 7.66% CSS 21.40%
predix-machine predix-cloud json-schema igs predix-dev factory cloudspace predix-global predix-configurator cloudfoundry

predix-configurator's Introduction

Predix Configurator

A Predix© configurator tool (cli) written in Python + an AngularJS 4 webapp to help you manage your Edge Connectivity stack, from machines in your factory to Predix microservices in your cloud space.

Factory stack

Note: the tool is intended for a factory infrastructure like the one below:

Picture

As you can see, the working schema involves:

  • Use of a machine-protocol gateway able to handle several industrial communication protocols used by different machines. For our purpose we used IGS by GE Automation;
  • Use of a Predix Machine (you can find pre-configured version of Predix Machine here and other useful starting template for your application in Predix Dev's Github page);
  • Available cloud space in Predix Platform;

How it works

The tool is intended for both Predix dev / common users. I prepared two different step-by-step guidelines:

  • Old-school way: prepare your JSON schema manually => run the configuration tool => enjoy.

  • Third Millennium way: prepare your JSON schema through the use of a stunning serverless web app XD => run the configuration tool => enjoy.

How it works: old-school way

The only script you need is the python script under the folder cli/ named predix-configurator.py. The script has only one dependency to pretty print xml to file. You can run it from your command line simply following this step:

git clone https://github.com/made2591/predix-configurator
cd predix-configurator
cd cli
#[optional create venv] virtualenv .venv & source .venv/bin/activate
pip install requirements.txt
python predix-configurator.py

When predix-configurator starts, it looks for a configuration file under the folder schema called your-factory.json (you can change the name of the file and update the const value in the header of the script with the new name / path as well).

A your-factory.json schema is already available in schema folder: for obvious reasons, I can't provide more details using real parameters instances XD.

JSON Schema details

GLOBAL_CONFIG

The GLOBAL_CONFIG key in the root of JSON specify the output path of python-configurator. When you run the predix-configurator.py, generated configuration files will be created in the GLOBAL_CONFIG.OUTPUT_DIR folder.

{
	"GLOBAL_CONFIG" : {

		"OUTPUT_DIR" : "./config/"

	},
}
GLOBAL_IGS_CONFIG

The GLOBAL_IGS_CONFIG key in the root of JSON specify IGS parameters. The most important parameter is SERVER_URI, that specify opcua endpoint exposed by your IGS instance to Predix Machine.

{
	"IGS_CONFIG" : {

		"SERVER_URI" : "opc.tcp://localhost:49310",
		"APP_URI" : "urn:localhost:Intellution.IntellutionGatewayOPCServer:UA Client Driver",
		"PRODUCT_URI" : "urn:localhost:UA:PredixMachine_OPCUAAdapter",
		"NAMESPACE_INDEX" : "your.namespace.index"
	},
}
PREDIX_GLOBAL_CONFIG

The PREDIX_GLOBAL_CONFIG key in the root of JSON specify Predix Machine most-important configuration file names and extensions. This field is intended to provide more flexibility to future version of Predix Machine.

	"PREDIX_GLOBAL_CONFIG" : {

		"GLOBAL_CONFIG_SUFFIX" : ".config",
		"DATATYPE_CONFIG_SUFFIX" : ".xml",
		"OPCUA_DATANODES" : "com.ge.dspmicro.machineadapter.opcua-0",
		"HOOVER_SPILLWAY" : "com.ge.dspmicro.hoover.spillway-0",
		"PREDIX_CLOUD_IDENTITY" : "com.ge.dspmicro.predixcloud.identity",
		"PREDIX_WEBSOCKER_RIVER" : "com.ge.dspmicro.websocketriver.send-0",
		"PROXY_CONFIGURATION" : "org.apache.http.proxyconfigurator-0"

	},
PREDIX_CLOUD_CONFIG

The PREDIX_CLOUD_CONFIG key in the root of JSON specify Predix Cloud most-important configuration parameters. Here you can define your timeseries Zone-ID (env vars), UAA parameters and proxy (if needed by your organization) with exceptions. The files involved by these keys are the one pointed by PREDIX_GLOBAL_CONFIG.PREDIX_WEBSOCKER_RIVER, PREDIX_GLOBAL_CONFIG.PREDIX_CLOUD_IDENTITY and PREDIX_GLOBAL_CONFIG.PROXY_CONFIGURATION.

	"PREDIX_CLOUD_CONFIG": {

		"TIMESERIES_ZONE_ID": "f37*****-****-****-****-************",
		"URL_OAUTH_TOKEN": "https://********-****-****-****-************.*****************/oauth/token",
		"APP_CLIENT_ID": "**********",
		"APP_CLIENT_SECRET": "**********",
		"PROXY_HOST": "**********",
		"PROXY_EXCEPTIONS": [
			"**********"
		]

	},

You can add more then one exception from Webgui (see below).

Picture

TAG_MAPPING_SCHEMA

The TAG_MAPPING_SCHEMA key in the root of JSON specify Tag Mapping between your Predix Cloud application and IGS (or your collector): it is a dict, with key defining Tag Mapping schema names, and values, the respective content of the schema. The file involved by these keys are the one pointed by PREDIX_GLOBAL_CONFIG.OPCUA_DATANODES.

NOTE: each Tag Schema have to be named: if you procede without giving a name to a Tag Schema, a default name will be assigned to the schema. Further, each Tag Couple has to be "headed" with a destination tags: if you procede without giving a name to a Tag Couple (pairing), a default head tag will be assigned. This logic is intended to prevent losing of partial setup during step.

	"TAG_MAPPING_SCHEMA": {

		"tag_mapping_schema_1": {

			"CHANNEL_PREFIX": "channel_prefix_1",
			"MAPPING": {
				"PREDIX_TAG_1": "MACHINE_TAG_1",
				"PREDIX_TAG_2": "MACHINE_TAG_2",
				"PREDIX_TAG_3": "MACHINE_TAG_3",
				"PREDIX_TAG_4": "MACHINE_TAG_4",
				"PREDIX_TAG_5": "MACHINE_TAG_5",
				"PREDIX_TAG_6": "MACHINE_TAG_6",
				"PREDIX_TAG_7": "MACHINE_TAG_7",
				"PREDIX_TAG_8": "MACHINE_TAG_8",
				"PREDIX_TAG_9": "MACHINE_TAG_9"
			}

		},

		"tag_mapping_schema_2": { ... },
		... // other schema go here

	}

You can easly add new Tag Schema using web app.

Picture

SITES

The SITES key in the root of JSON specify Sites and Groups of machine: it is a dict, with key defining Site names, that maps into another dict, with key defining Group name, the maps into another dict with values defining the specific Group. In the last step before result you can define machines for each Group in each Site. The key are clear: GLOBAL_ENABLE_SETUP enable setup for each machine, GLOBAL_TAG_MAPPING_SCHEMA schema will define a general tag mapping schema (you could define a local one for each machine in each group, and enable/disable setup for specific machine), and so on... The file involved by these keys are the one pointed by PREDIX_GLOBAL_CONFIG.OPCUA_DATANODES.

NOTE: each Site and each Group of machines in each Site have to be named: if you procede without giving a name to a Site Schema, a default name will be assigned to the schema. Further, each Group has to be "headed" with a name: if you procede without giving a name to a Group, a default head name will be assigned. This logic is intended to prevent losing of partial setup during step.

  "SITES": {
    "site_1_name": {
      "group_1_name": {
        "GLOBAL_TAG_MAPPING_SCHEMA": "tag_mapping_schema_1",
        "GLOBAL_ENABLE_SETUP": true,
        "GLOBAL_PREFIX": "predix.group.prefix.1_",
        "MACHINES": {
          "machine_plate_1": {
            "PCU": "pcu_name_1",
            "IP": "machine_ip",
            "NAT": "machine_natted_ip",
            "INFO": "machine_description",
            "PROTOCOL": "machine_protocol",
            "LOCAL_TAG_MAPPING_SCHEMA": "tag_mapping_schema_1",
            "LOCAL_ENABLE_SETUP": true
          },
          "machine_plate_2": {

        "tag_mapping_schema_2": { ... },
        ... // other schema go here

	}
MACHINES

The MACHINES key in the body of a Group specify machines: it is a dict, with key defining properties. They are not all necessary: the most important are the machine plate and the PCU name for IGS. The other one are only descriptive information. The file involved by these keys are the one pointed by PREDIX_GLOBAL_CONFIG.OPCUA_DATANODES.

NOTE: each machine plate must be different from the others in the same Group.

  "SITES": {
    "site_1_name": {
      "group_1_name": {
        "GLOBAL_TAG_MAPPING_SCHEMA": "tag_mapping_schema_1",
        "GLOBAL_ENABLE_SETUP": true,
        "GLOBAL_PREFIX": "predix.group.prefix.1_",
        "MACHINES": {
          "machine_plate_1": {
            "PCU": "pcu_name_1",
            "IP": "machine_ip",
            "NAT": "machine_natted_ip",
            "INFO": "machine_description",
            "PROTOCOL": "machine_protocol",
            "LOCAL_TAG_MAPPING_SCHEMA": "tag_mapping_schema_1",
            "LOCAL_ENABLE_SETUP": true
          },
          "machine_plate_2": {

        "tag_mapping_schema_2": { ... },
        ... // other schema go here

	}

How it works: Third Millennium way

I create an angular4-based webapp to help you create your your-factory.json configuration file. The app will guide you through various step, but you can always see in real time the preview of your json configuration changing over time. You can setup your app to run locally or use the one host on TODO

Setup Webapp to run locally

Make sure you have NPM and AngularCLI installed on your machine. Then:

git clone https://github.com/made2591/predix-configurator
cd predix-configurator/webgui
npm install
ng serve

And point your browser to http://localhost:4200/

Welcome Page

Picture

STEP 1: IGS Configuration Page

Picture

STEP 2: Predix Global Configuration

Picture

STEP 3: Predix Cloud Configuration

Picture

STEP 4: Tag Schemas Configuration

Picture

STEP 5: Sites Groups Configuration

Picture

STEP 6: Machines Configuration

Picture

STEP 7: Result

Picture

Thank you

  • cwun, I was really inspired by your multi-step wizard using UI-Router 1.0 and TypeScript 2.0.10.

predix-configurator's People

Contributors

made2591 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.