Switch to desktop version  
Central Data Collection - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Ewon Embedded Technology (https://techforum.ewon.biz/forum-51.html)
+---- Forum: Ewon Connection Tools (https://techforum.ewon.biz/forum-6.html)
+---- Thread: Central Data Collection (/thread-113.html)



Central Data Collection - Edward Ross - 22-08-2016

We are building a fetcher tool to read data from the M2Web API and log it centrally in a database. We are planning to use the following database structure.

The database will contain a table to store a list of tags to collect and a table containing the historical
tag values.

The tag names will have the following fields:
• Tag ID
• eWon Talk2M ID
• ModBus Tag Address
• Tag Name
• Tag Description

Tag historical tags table will have the following fields:
• Tag ID
• Timestamp

Are there any tips about the database structure from those who have done this before?


RE: Central Data Collection - simon - 24-08-2016

(22-08-2016, 03:54 PM)Edward Ross Wrote: We are building a fetcher tool to read data from the M2Web API and log it centrally in a database. We are planning to use the following database structure.

The database will contain a table to store a list of tags to collect and a table containing the historical
tag values.

The tag names will have the following fields:
• Tag ID
• eWon Talk2M ID
• ModBus Tag Address
• Tag Name
• Tag Description

Tag historical tags table will have the following fields:
• Tag ID
• Timestamp

Are there any tips about the database structure from those who have done this before?


Edward,

Good to hear :-)

1. Why to put the Talk2M ID in the Tag database as it is common to the whole application ?
2. Historical tags, I guess you miss the value and the quality fields ?
3. Why don't you use the Datamailbox for getting this historical data ? (https://developer.ewon.biz/content/dmweb-api).  The only thing the Datamailbox won't provide is the Modbus address of the Tag but you could easily get it from a M2Web API call.

You could get ideas from eSync (= our tool to gather data) regarding the database structure : https://ewon.biz/sites/default/files/aug-029-0-en-esync_data_transfer_management.pdf

Regards


RE: Central Data Collection - Edward Ross - 25-08-2016

Thanks for your reply. The esync table structure is a useful reference here!

1. Why to put the Talk2M ID in the Tag database as it is common to the whole application ?
There will be multiple eWON routers - so by this variable I mean to identify the router.  This would be equivalent to the entries in the table esync_stations


2. Historical tags, I guess you miss the value and the quality fields ?
Oops - yes, I meant to include a value field here!

3. Why don't you use the Datamailbox for getting this historical data ? (https://developer.ewon.biz/content/dmweb-api).  The only thing the Datamailbox won't provide is the Modbus address of the Tag but you could easily get it from a M2Web API call.
Yes, this is probable the best API for me to use. Thanks for drawing my attention to this.


RE: Central Data Collection - Edward Ross - 26-08-2016

I have two follow up questions, which weren't clear to me after looking in the eSync manual:
- Does the eSync tool also use the Data Mailbox through the dmweb-api?
- Does the eSync tool automatically fetch data at certain intervals, or does it need to be manually triggered

I found this presentation, which answers my question on pages 15 and 16, eSync needs to be on a public IP and is used instead of the data mailbox.
https://developer.ewon.biz/sites/default/files/Flexthink2016_IIOT_Vision.pdf


RE: Central Data Collection - Kevin - 29-08-2016

(25-08-2016, 05:52 PM)Edward Ross Wrote: 1. Why to put the Talk2M ID in the Tag database as it is common to the whole application ?
There will be multiple eWON routers - so by this variable I mean to identify the router.  This would be equivalent to the entries in the table esync_stations

Are the eWON's registered to separate accounts? I'm not entirely sure if you mean eWON ID or Talk2M ID.
The getewons API call will return eWON ID's. If you haven't yet looked over the DMWeb API, I suggest looking it over to get an idea of how data will be returned to you. This will help you identify the best way to structure your database to get the data you need.

I'm not sure how much granularity you need, but in general it's good DB practice to remove as much redundancy as possible. So, you'd most likely want to store definitions for eWON's in a separate table, perhaps topic definitions separately (If you expect to receive data under multiple topics), then a historical data table. Link everything with foreign keys to make life easier on yourself in the future.

(26-08-2016, 11:23 AM)Edward Ross Wrote: - Does the eSync tool automatically fetch data at certain intervals, or does it need to be manually triggered

I can't answer your first question regarding if eSync uses the DM (I don't know what they use), but I can answer this one.
You can specify conditions to upload data or time intervals to upload data. Data should be available for collection once the eWON's have pushed it to the server.

eWON refers to this as "Push technology", you can read some more about this here:
https://developer.ewon.biz/content/esync


RE: Central Data Collection - simon - 29-08-2016

- Does the eSync tool also use the Data Mailbox through the dmweb-api?
There is an add-on for enabling the Data collection through the Data mail Box in eSync : https://ewon.biz/sites/default/files/kb-0243-0-en_esync_datamailbox_connector.pdf
- Does the eSync tool automatically fetch data at certain intervals, or does it need to be manually triggered
No, eSync is a web server that waits for the eWON HTTP(S) Posts.  So, when using eSync, this is the eWON that pushes its data and not the eSync that polls the eWON's data.
When using the DataMailBox connector for eSync, we add some PHP scripts in eSync that grab the data from the datamailbox. This script is triggered automatically thanks to a Windows Schedule task.



RE: Central Data Collection - simon - 29-08-2016

Thanks Kevin!!
Good job