Upload
codemotion
View
467
Download
1
Embed Size (px)
Citation preview
MILAN 21.11.2015
Monet: a NodeJS enterprise system for IoT and Energy Management
MATTEO MURGIDA - SIEMENS SPA
MILAN 21.11.2015 - MATTEO MURGIDATable of contents
• What is Monet?• Technology: why node?
• High Level Architecture
• Micro-services Architecture
• Cloud Architecture
• Façade
• Dispatcher
• MQTT & Gateway
• Leveraging The Cloud
• Deployment and Runtime Tools
• Future Improvements
MILAN 21.11.2015 - MATTEO MURGIDAWhat is Monet? (1/2)
Monet, Smart Grid Energy Management Cockpit
Monet is a Cloud platform providing set of services for Energy Monitoring and Energy Management following the Software as a Service model.
It is a solution for monitoring, controlling, and optimizing energy flows inside a specific site or location being a Smart Grid, a Micro Grid, a Smart City or part of it.
MILAN 21.11.2015 - MATTEO MURGIDAWhat is Monet? (2/2)
Smart Metering Systems
Monet – Energy Management System
Building Automation
Systems
Energy Monitoring / Energy Reporting
Energy Efficiency / Demand Response
Distribution Network SCADA Systems
Site/Plant SCADA Systems
Other Smart City Systems
(electric vehicle infrastructure, public
lighting, …)
Home / IOT Devices
Energy Profiling / Generation Forecast
MILAN 21.11.2015 - MATTEO MURGIDAWhy NodeJS?
“Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”
MILAN 21.11.2015 - MATTEO MURGIDATable of contents
• What is Monet?
• Technology: why node?
• High Level Architecture• Micro-services Architecture
• Cloud Architecture
• Façade
• Dispatcher
• MQTT & Gateway
• Leveraging The Cloud
• Deployment and Runtime Tools
• Future Improvements
Monet middleware
BUS
Prem
ise
Clo
ud
M2M
Web
App
Field
Monet Operation CenterNO
DE.J
S
EXPR
ESS
MONGODB
REST Interface (Http/Https)
HTML5 / CSS / Javascript
Sencha ExtJS
MQTT
Monet OC Mobile
HTML5 / CSS / Javascript
Sencha Touch / Apache Cordova
COREPackage
Energy ReportingPackage
Gen. ForecastPackage
Gateway60870-5-104
Gateway62056-21
Gateway61850
GatewayModbus
GatewayArchilede
GatewayEMM
GatewaySTM
GatewayDesigo
Green ButtonActive Demand
Package
GatewaySmart Info
MILAN 21.11.2015 - MATTEO MURGIDAHigh Level Architecture
• Monet follows the Micro-Service Architecture pattern
• It has a service for each functionality package that expose a REST API
• It has jobs to perform background tasks and complex calculations
• Services communicate via the Dispatcher module and the Service Bus.
MILAN 21.11.2015 - MATTEO MURGIDAMicro Services Architecture (1/2)
MILAN 21.11.2015 - MATTEO MURGIDAMicro Services Architecture (2/2)
Monet Business Logic Tier
BUS
M2M
MQTT
MQTTFeeds Broker
MONGODB
Monet Presentation Tier
Energy ReportingServices
Things Service
Trends Service
Gen. ForecastServices
Energy Service
Energy Job
REST RESTCORE
Services
Facade
REST
Trends Job
Graphics Service
Assets ServiceNotifier Events Service
Dashboards
Sites Service
Authentication
Users
Stakeholders
Triggers Job
Forecast Service
Dashboard(s) ThingsManagement
AssetsManagement
EnergyManagement Reporting Active DemandTicketingAdministration
Customers
Ticketing
Active DemandServices
REST
Active Demand Service
Active Demand Job
Energy RulesService
MILAN 21.11.2015 - MATTEO MURGIDATable of contents
• What is Monet?
• Technology: why node?
• High Level Architecture
• Micro-services Architecture
• Cloud Architecture
• Façade• Dispatcher
• MQTT & Gateway
• Leveraging The Cloud
• Deployment and Runtime Tools
• Future Improvements
The EMS System via its M2M component is able to acquire data directly from field devices.
Sometimes this is not possible or it is not convenient for several reasons:
§ devices own protocol is not “Internet of Things ready”§ communication infrastructure§ security
In these scenarios the EMS Gateway is able to collect data from devices and to send them to the EMS-M2M in an optimized and secure way.
MILAN 21.11.2015 - MATTEO MURGIDAGateway (1/3)
MILAN 21.11.2015 - MATTEO MURGIDAGateway (2/3)
Mosca is used as MQTT broker. It is a powerful nodejs module that can be usedstandalone or can be run inside a custom nodejs module.
MILAN 21.11.2015 - MATTEO MURGIDAGateway (3/3)
§ Gateway Configuration and Subscriptions flow:§ The gateway has the basic info to connect to the MQTT Broker
§ It subscribes to the topic gw/gatewayMqttClientId/dr/+/conf
§ It subscribes to the topic dr/driverId/de/+/conf
mqttbroker
MILAN 21.11.2015 - MATTEO MURGIDATable of contents
• What is Monet?
• Technology: why node?
• High Level Architecture
• Micro-services Architecture
• Cloud Architecture
• Façade
• Dispatcher
• MQTT & Gateway
• Leveraging The Cloud• Deployment and Runtime Tools
• Future Improvements
MILAN 21.11.2015 - MATTEO MURGIDACommunication Strategies
Service A.1 Service A.2
Service B.1 Service B.2
Req 1
Req 1Req … Res 1
Res 1Res 1
§ Monet is composed by several nodejs modules that are deployed as subfolders in the main “backend” module.
§ Each module has its own conf file, that can be overridden by a common global conffile
§ A “core” module colled Overlord reads the main configuration files and acts asprocess / logging manager
§ Moving towards a more flexible and structured approach via npm private repository
MILAN 21.11.2015 - MATTEO MURGIDADeployment
§ Forever is a process monitor: it starts and watchdogs the desired nodejs processes
§ Bunyan is a json logging tool implementing a lot of different transports
MILAN 21.11.2015 - MATTEO MURGIDARuntime Tools
MILAN 21.11.2015 - MATTEO MURGIDAThe importance of using npm shrinkwrap
§ npm shrinkwrap command locks down the versions of a package's dependencies so that you can control exactly which versions of each dependency will be used when your package is installed.
§ Wildcards are commonly used when specifying dependencies in package.json. These are very handy but can be very harmful when you have to deploy your stuff in production environments
§ This is the only way you have to be sure to deploy the same thing every time you do an npm install
§ You can always check for outdated dependencies using npm outdated
§ First of all: we must go towards having a repo per submodule, and a npm package for each submodule using a private NPM repository. A good choice should besinopia.
§ Use git
§ Dockerize all this stuff
§ Use a cluster / processes manager like pm2 to manage all the differentsubprocesse, resources and logging
MILAN 21.11.2015 - MATTEO MURGIDAFuture Improvements
MILAN 21.11.2015 - MATTEO MURGIDAnodeschool
http://nodeschool.io/
https://github.com/nodeschool/italy/issueshttp://nodeschool.io/italy