Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

TELANGANA STATE POLLUTION CONTROL BOARD

The Open API (Application Programmable Interface) for other


Software developers to develop in client side requirements for
TSPCB and establish connectivity with the central software of
TSPCB. The interested developers after development shall contact
TSPCB approval (Please refer the certification process section for
more details).

EnviroConnect Server API Page 1 of 16


TSPCB Server API
Development Manual

Version No. 1.1


Date: - Dec 28, 2015

„Dnyanamayi‟, 1, Shreeniketan Society,


Kothrud, Pune 411038

Tel. 91-20-6500 4608 Fax


91-20-25465217 E-mail
info@aiplindia.com
www.plantconnect.net

EnviroConnect Server API Page 2 of 16


Table of Contents

OVERVIEW ................................................................................................................................................. 4
1.1. INTRODUCTION .......................................................................................................................... 4
1.2. SENDING DATA TO ENVIROCONNECT SERVER .................................................................................. 4
1.3. CONFIGURATION ........................................................................................................................ 5

2. ENVIROCONNECT SERVER API VER 1.1 ........................................................................................... 6


2.1. SERVER URL ............................................................................................................................ 6
2.2. SEND DATA .............................................................................................................................. 6
2.3. SEND DELAYED DATA ................................................................................................................ 9
2.4. I AM ALIVE ................................................................................ ERROR! BOOKMARK NOT DEFINED.
2.5. SEND CALIBRATION RESULT........................................................................................................ 12
2.6. CERTIFICATION PROCESS............................................................................................................ 13
2.7. CONTACT DETAILS.................................................................................................................... 14
3. CLIENT SIDE SOFTWARE REQUIREMENTS ................................................................................... 15

EnviroConnect Server API Page 3 of 16


Overview

1.1. Introduction
Telangana State Pollution Control Board (TSPCB) has implemented EnviroConnect as
central aggregator server software for real rime data acquisition and handling system for
CEMS, AAQMS and Water data monitoring in Telangana state.

EnviroConnect server accepts data from any authorized field client. This document
describes the method of uploading data to EnviroConnect server and will provides all
technical details required for implementing data transmission in client software.

In addition EnviroConnect has its own field client called EnviroConnect DAM which
provides all features described in this document and more.

For any further queries and assistance, please contact


TSPCB.EnviroConnect@aiplindia.com.

1.2. Sending data to EnviroConnect Server


Clients must use EnviroConnect server API to transmit data to TSPCB EnviroConnect
server as per requirements of Pollution Control Boards.

Following must be followed while implanting the API based upload.

1. Data must be acquired directly form the analyser without any other software ot
any other utility as an intermediate destination
2. Fool proof algorithms must be implemented to ensure that the data is not
tampered with in the process of acquisition
3. Local storage in case of failure of internet link must be secured storage without
any access to any user

Following rules apply for transmitting data


1. Each Stack / Ambient Station / ETP / STP constitutes a Site and is treated as a
single „Station‟. In reality there may be multiple analyzers and other instruments /
devices that measure the data.
2. Client program should send all applicable data like polluting parameters,
diagnostics parameters, weather data (where applicable), etc. thru the API.
3. Client should also send applicable data quality flags for each polluting parameter.
These flags are described further in this document.
rd
4. 2-way communication between EnviroConnect server and 3 party client is to be
ensured through server API.
5. Video data/ files are not to be handled via this API

EnviroConnect Server API Page 4 of 16


Server API
Mode of communication REST API (HTTPS / JSON)
Polluting parameters with data quality flags Yes
Diagnostic data Yes
Real time data Yes
2-way communication Yes
Remote calibration (Not applicable for ETP) Yes

1.3. Configuration
Before any client can start sending data to TSPCB EnviroConnect Production Server, the
particular Plant, Site within the plant and stack should be configured using
EnviroConnect Admin Tool. This will be taken care of by AIPL Team on instructions
from concerned authority within TSPCB.

Please go through the “Certification Process” section in the document below for more
details on configuration, testing of server API and certification.

EnviroConnect Server API Page 5 of 16


2. EnviroConnect Server API Ver 1.1

This API provides full functionality including remote calibration. Following is a list of
supported functions

Sr. Function Description


1. Send Data Send real time data and flags to server
2. Send delayed data Send delayed data, status and flags to server. This
function is used if real time data was not sent due to
failure in internet connection
3. Check Command ”Check Command” or heart beat request. This
request is used for initiating remote calibration.
This request is also used for initiating 2 way
communication from server to client.
4. Send Calibration Result Send calibration result to server
(Not applicable for
ETP)

This is a RESTful API where clients communicate with server using HTTPS
requests. All request and response data is in the form of JSON objects.

2.1. Server URL


https://tspcb.ecc.gov.in:8080/enviroconnect/ (Subject to change as per TSPCB guidelines)

Server IP - server domain name or IP address (tspcb.emc.gov.in)


Port - port number (normally 8080)

2.2. Send Data


This request is used for sending current data and data flags along with a time stamp. This
request should be sent in real time every 1 minute. Client should average all data polled
within 1 minute and send to server.

Request Details

Parameter Description Possible values


FunctionName Request code 53
Name User Name specified in Will be provided after
EnviroConnect Site registration on
configuration page EnviroConnect server
Password Password specified in Will be provided after
EnviroConnect Site registration on

EnviroConnect Server API Page 6 of 16


Parameter Description Possible values
configuration page EnviroConnect server
DeviceID ID generated by Integer Value
EnviroConnect server
when device is configured
DateTime Data send Date Time YYYY-MM-DD HH:mm:SS
(24 hour clock)
additionalInfo :
additional info to get GPS co-ordinates and client software name and
version All the data from this block will be tread as a variable in our system
LATITUDE latitude value of a device -
LONGITUDE Longitude value of a -
device
SOFTWARENAME Software name and version -
Variables : Collection of variables
VariableName Parameter Name NO, NOX, SO, SOX etc.
Value * Average Value of Precision - 3 (float value
Parameter for selected with 3 digits after decimal)
minute e.g. 123.456
Flags Calibration/ Maintenance C/M
Unit Unit of measure for
selected parameter

* If data of a particular parameter is not available on site due to any reason, its value
should be sent as “err”

All above details are sent to server as a JSON object. The structure is given in below
example

Example

'FunctionName': 53
'Name' : 'UserName'
'Password' : 'Password'
'DeviceID' : 1
'Datetime' : "2015-06-10 12:30:00"

'additionalInfo' : {
"LATITUDE","Value":'17.87‟,
"LONGITUDE","Value":'79.10',
"SOFWARENAME","Value":'fm varsion 1.0'
},
'Variables' : {
{"Variablename":"NO2","Value":12.2,”Flags”:””,"Unit":"mg/nm3"},
{"Variablename":"NOX","Value":122.2, ”Flags”:””,"Unit":"mg/nm3"},
{"Variablename":"SO2","Value":0.0,”Flags”:”C”,"Unit":"mg/nm3"},

EnviroConnect Server API Page 7 of 16


}
Sample Code

HttpClient client = new DefaultHttpClient();


HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout
Limit HttpResponse response;
JSONObject json = new JSONObject();

HttpPost post = new HttpPost(URL);


json.put("deviceid", deviceid);
json.put("username", user);
json.put("password", pwd);

JSONArray jsonVariables = new


JSONArray(); // Repeat this for each variable
JSONObject jsonVariable = new JSONObject();
jsonVariable.put(“Variablename”,”NO2”);
jsonVariable.put(“Value”,”12.2”);
jsonVariable.put(“Flags”,””);
jsonVariable.put(“Unit”,” mg/nm3”);
jsonVariables.add(jsonVariable);

// put all parameters list in json


json.put('Variables", jsonVariables);

StringEntity se = new StringEntity( json.toString());


se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json")); post.setEntity(se);
response = client.execute(post);

Response Details

„ResultCode‟ : 1/2/3
'Message' : „Error Message if any‟

Code 1 indicates success. Other codes indicate error. An associated error message is
provided

Response Code Message


1
2 Invalid User Name and Password
3 Incomplete Data

*Multiple errors may get added. For ResultCode “1” i.e. success, there will be no
Message.

EnviroConnect Server API Page 8 of 16


2.3. Send Delayed Data
This request is used for sending delayed data and data flags along with a time stamp. This
request should be sent if current data gets failed. Client should average all data polled
within 1 minute and send to server. It may have multiple records in single request

Request Details

Parameter Description Possible values


FunctionName Request code 54
Name User Name specified in Will be provided after
EnviroConnect Site registration on
configuration page EnviroConnect server
Password Password specified in Will be provided after
EnviroConnect Site registration on
configuration page EnviroConnect server
DeviceID ID generated by Will be provided when
EnviroConnect server when device is added on
device is configured EnviroConnect server
additionalInfo :
additional info to get GPS co-ordinates and client software name and
version All the data from this block will be tread as a variable in our system
LATITUDE latitude value of a device -
LONGITUDE Longitude value of a device -
SOFTWARENAME Software name and version -
Records - Collection of old Records
Record Single record JSONObjectcontains
following fields
DateTime Data send Date Time YYYY-MM-DD
HH:mm:SS
Variables - Collection of variables
VariableName Parameter Name NO, NOX, SO, SOX etc.
Value * Average Value of Parameter Precision - 3 (float value
for selected minute with 3 digits after decimal)
e.g. 123.456
Flags Calibration/ Maintenance C/M
Unit Unit of measure for selected
parameter

* If data of a particular parameter is not available on site due to any reason, its value
should be sent as “err”

EnviroConnect Server API Page 9 of 16


Example

'functionName' : 54
'Name' : 'UserName'
'Password' : 'Password'
'DeviceID' : 1

'additionalInfo' : {
"LATITUDE","Value":'17.87‟,
"LONGITUDE","Value":'79.10',
"SOFWARENAME","Value":'fm varsion 1.0'
},

„Records‟:
{
„record‟ :{
'Datetime' : "2015-06-10 14:30:00"
'Variables' : {
{"Variablename":"NO2","Value":12.2,”Flag”:””, "Unit":"mg/nm3"},
{"Variablename":"NOX","Value":122.2, ”Flag”:””,"Unit":"mg/nm3"},
{" Variablename":"SO2","Value":23.2, ”Flag”:””,"Unit":"mg/nm3"}, {"
Variablename":"SOX","Value":43.2, ”Flag”:””,"Unit":"mg/nm3"}
}
},
„record‟ :{
'Datetime' : "2015-06-10 14:31:00"
'Variables' : {
{"Variablename":"NO2","Value":”err”, ”Flag”:””,"Unit":"mg/nm3"},
{"Variablename":"NOX","Value":122.2”Flag”:””,,"Unit":"mg/nm3"},
{"Variablename":"SO2","Value":23.2, ”Flag”:””,"Unit":"mg/nm3"},
{"Variablename":"SOX","Value":43.2, ”Flag”:””,"Unit":"mg/nm3"}
}
}
}

Response Details

„ResultCode‟ : 1/2/3
'Message' : „Error Message if any‟

Response Code Message


1
2 Invalid User Name and Password
3 Incomplete Data

*Multiple error may get added. For ResultCode “1” i.e. success, there will be no
Message.

EnviroConnect Server API Page 10 of 16


2.4. Check Command
“Check Command” request checks for „User Initiated Calibration‟ and send indication for
client to start Calibration. This request is also used for initiating 2 way communication
from server to client.
Thru the response of this command, server asks the client to process one or more
commands for the device. Currently supported command is “User Initiated Calibration”.
Client should process this command asynchronously and when complete, send the result
back via „Send Calibration result‟ request.

Vendors have to send the “Check Command” request periodically to check any command
pending from server side. If any command is received from the server then its vendor‟s
responsibility to take appropriate action on the command.

Request Details

Parameter Description Possible values


FunctionName Request code 55
Name User Name specified in Will be provided after
EnviroConnect Site registration on EnviroConnect
configuration page server
Password Password specified in Will be provided after
EnviroConnect Site registration on EnviroConnect
configuration page server
DeviceID ID generated by Will be provided when device
EnviroConnect server is added on EnviroConnect
when device is configured server
DateTime Data send Date Time YYYY-MM-DD HH:mm:SS

Example

'functionName' : 55
'Name' : 'UserName'
'Password' : 'Password'
'DeviceID' : 1
'Datetime' : "2015-06-10 12:30:00"

Response Details

„ResultCode‟ : 1/2/3/100 'Message'


: „Error Message if any‟
„Calibration‟ : „<gasparameter
name>‟ „CalibrationId‟ :12

Response Code Message


1

EnviroConnect Server API Page 11 of 16


2 Invalid User Name and Password
3 Incomplete Data
100 Calibration

*Multiple errors may get added. For ResultCode “1” i.e. success, there will be no
Message.

2.5. Send Calibration result


This request is used for sending calibration result after Calibration.

Request Details

Parameter Description Possible values


FunctionName Request code 56
Name User Name specified in Will be provided after
EnviroConnect Site registration on EnviroConnect
configuration page server
Password Password specified in Will be provided after
EnviroConnect Site registration on EnviroConnect
configuration page server
DeviceID ID generated by Will be provided when device
EnviroConnect server is added on EnviroConnect
when device is configured server
DateTime Data send Date Time YYYY-MM-DD HH:mm:SS
Calibration ID Id comes in “I Am Alive”
request
Calibration result Calibration result Success/failure
Comment If calibration fails, any
specific reason

Example

'functionName' : 56
'Name' : 'UserName'
'Password' : 'Password'
'DeviceID' : 1
'Datetime' : "2015-06-10 12:30:00"
„CalibrationID‟ : 12
„Calibration Result‟ : „success/failure‟
„Comment‟: „Comment if fail‟

Response Details

„ResultCode‟ : 1/2/3
'Message' : „Error Message if any‟

EnviroConnect Server API Page 12 of 16


Response Code Message
1
2 Invalid User Name and Password
3 Incomplete Data

*Multiple errors may get added. For ResultCode “1” i.e. success, there will be no
Message.

2.6. Certification Process


Only certified vendors are allowed to send data to TSPCB-EnviroConnect production
server. Once the vendor is done with the API implementation, here are the steps to follow
for certification

1. Certification request has to send to TSPCB.EnviroConnect@aiplindia.com.


2. Once the request is received, TSPCB will send a request form. Vendors has to send the
filled request form to the above email address
3. Once the request from is received, a test account will be created on TSPCB Test server.
4. Test account information will be shared for testing the server API on TSPCB Test
server.
5. Vendors have to send the data from their analyzer using the server API on TSPCB test
server.
6. Once the success feedback received from TSPCB test server, vendors have to share
data sent to test server in document format the above email address.
7. TSPCB will verify the data on server and give feedback.
8. After the successful verification of data on TSPCB test server, vendors will be certified
to send data on TSPCB-EnviroConnect production server using the server API.

Note:
1. Vendors should be responsible to use same software version which is certified, any
change in vendor software related to EnviroConnect API, needs re-certification.
2. The errors returned by EnviroConnect API should be handled and corrected by
vendor.
3. In production system, vendor software must have mechanism to log / display
errors returned by EnviroConnect API so that administrator of vendor software is
able to take corrective action
4. Remote Calibration user request sent from EnviroConnect API should be taken
care by Vendor to perform actual calibration and result should be shared with
EnviroConnect server using API.

EnviroConnect Server API Page 13 of 16


2.7. Contact Details

1.2. Contact Details

M/S Sunshine Technologies


Flat No. S-17, 1-11-252/1, Alladin Mansion, St. No. 3,
Address Lane beside Shoppers Stop, Begumpet,
Hyderabad – 500 016. Telangana State.

support@sunshinetechno.com;
Email: sunshinetechnologies@yahoo.com.

040-64440004; 9133377851 ; 9133377852;


Phone No: 9133377853; 9133377854

M/S Ascent Intellimation Pvt LTd


Dnyanmayi,1,shreeniketan Society, Mayur Colony,
Pune .
Address
Br Office : Flat no 403, Kalanjali classic,
Scientist Colony, Habsiguda, Hyderabad - 500007

TSPCB.EnviroConnect@aiplindia.com;
Email
amol.joshi@aiplindia.com

Phone No. Ph : +91 7702766503 / 9963278563.

EnviroConnect Server API Page 14 of 16


3. Client Side Software Requirements

1. The data collection and transmission module should directly connect to the installed
analyzer and fetch the data directly from the analyser without any intermediary
software or conversions. The software should have no editing provision for
altering/correcting the data at the industry side.

2. No data shall be accepted as an output from OPC of Server or DCS or any other
intermediate software at Industry side.

3. During internet connectivity failure or a communication issue with the central


server, the data collection and transmission module should store the data locally and
retransmit when the transmission can be restored. Any such delayed transmission
should be identifiable at the regulator side using data quality codes.

4. The data collection and transmission module should wait for acknowledgement
from the' server and should retransmit the data if no acknowledgement is received
within the timeout period.

5. Each measurement should be associated with the data quality code inferred while
data collection and the data quality code should be transmitted along with the data.
The data quality code should indicate communication failures, calibration,
maintenance etc.

6. The data collection and transmission module should accept commands for calibration
(auto and manual) and able to perform calibration of the analyser locally.

7. The data collection and transmission module should be able to collect the
data directly from the analyser with a minimum scan interval of 10 seconds.

8. Data collection and transmission shall be minimum 15 min or other mean


average period selectable by user.

9. The data collection and acquisition software should be able to collect and encrypt the
data locally on the industry site. The data should archive the data locally on the client
machine for a period of 1 year.

10. The data collection and transmission module should communicate the status
periodically to the central server even when no analyser is connected or
when analyser is faulty with appropriate data quality code.

11. The data collection and transmission module should auto-restart on failure or
machine reboots.

EnviroConnect Server API Page 15 of 16


12. The data collection and transmission module should be able to transmit the data over
Broadband/LAN/wifi/gprs etc.

13. The data collection and transmission module should support any analyser, make and
model based on the configuration and protocol specific extensions.(analyser
suppliers should be open enough to share their analyser output protocol for easy data
transmission digitally)

14. The data collection and transmission module should be customizable to support
any specific protocol required.

EnviroConnect Server API Page 16 of 16

You might also like