Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Technology)

42 views

Published on

OSGi Community Event 2018 Presentation by Jörn Tümmler (SMA Solar Technology)

Abstract: SMA is a leading global specialist in photovoltaic system technology with more than 3,000 SMA employees in 20 countries.

In 2015 SMA decided to develop the ennexOS platform - a cross-sector platform for holistic, intelligent energy management. An important part of this platform is the data-manager - an IoT gateway that acquires information from various energy generators, storages and loads and performs commissioning and management tasks.

This new generation of data-managers demanded for new approaches in software-architecture to:

run on a broad range of hardware platforms, and
be extendible e.g. to support different protocols for easy integration, and
to enable a broad range of applications in the energy-management field that may be customized by apps installed during runtime
After an exhaustive investigation on existing solutions, OSGi was chosen as the key technology for this new generation of devices - a quite challenging decision, because at this point there was only limited experience in Java and OSGi development in the company.

This talk will present the key factors that lead to this decision, how we very carefully build up Java and OSGi knowledge, and started with an initial design. OSGi enRoute and the support of OSGi experts helped us to accelerate our development and become familiar with OSGi - although we also had times when we were struggling because of the new technology.

The talk will demonstrate what we have reached until now and we will tell you if OSGi has kept it's promise ...

Published in: Technology
  • Be the first to comment

How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Technology)

  1. 1. How OSGi drives cross sector energy management SMA Solar Technology AG
  2. 2. WHO IS SMA? > SMA is an energy equipment supplier founded in 1981 and headquartered near Kassel in the middle of Germany > Main products are solar inverters for photovoltaics systems > These products are complemented by components for energy management, system monitoring and data analysis and the world’s largest PV monitoring portal > More than 3,000 employees, thereof 500 in technology > Since 2018 SMA is a contributing associate of the OSGi alliance 16.11.2018 2How OSGi drives cross sector energy management, Jörn Tümmler STP 6.0 with integrated MLPE-communication CORE1, 50 kW Sunny Boy Storage 6.0 ennexOS energy management platform
  3. 3. AGENDA 1 2 3 4 What is cross sector energy management? Searching for a solution Getting started with OSGi Getting lost 5 Starting over 16.11.2018 3How OSGi drives cross sector energy management, Jörn Tümmler
  4. 4. WHY ENERGY MANAGEMENT? 4
  5. 5. WHAT DOES CROSS SECTOR ENERGY MANAGEMENT MEAN? 5 The connectivity of all energy sectors is crucial for the new energy world. All different systems need to be continually optimized to make the most efficient use of energy. The Internet of Things (IoT) is the technical basis for connecting and managing different devices. In the energy market, IoT is a driving force to create the future of energy.
  6. 6. SYSTEM CONTEXT 6
  7. 7. MAIN GOALS AND REQUIREMENTS > Provide a platform for advanced energy management: > Extendable by new protocols for easy integration > Extendable data-processing facilities to combine different control and energy management strategies > High throughput of data for monitoring and control commands > Portable solution to run on different ARM- and X86 based systems > Consolidate the portfolio of existing data-loggers and management devices: > Improve our software-architecture and bring it to next level of modularity: > Although we had already a software library with modules we had dependency issues and inadequate life-cycle mechanisms 16.11.2018 7How OSGi drives cross sector energy management, Jörn Tümmler Multigate Webconnect Home Manager WebBox RS485 WebBox BT Cluster Controller SC30COMPower Plant Controller
  8. 8. AGENDA 1 2 3 4 What is cross sector energy management? Searching for a solution Getting started with OSGi Getting lost 5 Starting over 16.11.2018 8How OSGi drives cross sector energy management, Jörn Tümmler
  9. 9. EXAMPLE ARCHITECTURE Investigations showed a typical blueprint for IoT gateways: > Component-based development > Central data-cache or data-bus > Pluggable extensions > Several OSGi based solutions available > We’ve evaluated four OSGi based solutions: > Two commercial solutions > Two open source solutions > The open source solutions allowed us to test the new technology regarding performance and usability > … and also to got in touch with OSGi 16.11.2018 10How OSGi drives cross sector energy management, Jörn Tümmler
  10. 10. OSGI LOOKS PROMISING, BUT HOW TO START? > The first plan was to use one of the open source solutions as basis > This was discarded because of technical limitations and high efforts to adapt it to our needs > To benefit from the advantages of a component based development, it was decided to develop an own framework based on OSGi, but tailored to the needs of SMA > It was clear that there would be a “learning curve” to establish this new technology: 11 Source: http://enroute.osgi.org/book/100-introduction.html How to lower the entry barrier and benefit from OSGi?
  11. 11. AGENDA 1 2 3 4 What is cross sector energy management? Searching for a solution Getting started with OSGi Getting lost 5 Starting over 16.11.2018 12How OSGi drives cross sector energy management, Jörn Tümmler
  12. 12. INITIAL SITUATION > We had a team of experienced developers with some knowledge of Java, but no OSGi experience > We knew how to develop communication gateways and energy managers … > … but chances were high that the new system would not taking real advantage of OSGi > Because of this, we had the following “master-plan”: > Train the team in Java and OSGi > Get support from external OSGi experts – at least one expert should be on-site > Develop an initial design together with the OSGi experts > OSGi experts should also accompany the team when developing the system 16.11.2018 15How OSGi drives cross sector energy management, Jörn Tümmler
  13. 13. INITIAL DESIGN > In several workshops we developed the initial design > The input of the OSGi experts resulted in a more fine grained service-architecture > Finally we combined the best of both worlds: 16.11.2018 16How OSGi drives cross sector energy management, Jörn Tümmler OSGi concepts > Eclipse with BndTools as development environment > OSGi R6 with Java 8: > enRoute (classic) as Basis > Apache Felix runtime > Declarative Services > Configuration Admin > Use WhiteBoard pattern for notifications, aggregations > Felix WebConsole and Gogo Shell for debugging SMA concepts > Central data-cache to store runtime information > Convert all incoming data into a “normalized” meta-data- model > Use “duck-typing” to identify data which needs to be processed > Matlab for control algorithms > Swagger/OpenAPI to define REST APIs for ui and portal communication
  14. 14. USE A META DATA MODEL TO UNIFY DATA 16.11.2018 17 How OSGi drives cross sector energy management, Jörn Tümmler Name Type Unit Metering.GridMs.TotWIn Scalar W Metering.GridMs.TotWOut Scalar W … … … Protocol Identifier Scaling Destination Reg500088 0,1 Metering.GridMs.TotWIn Reg500089 0,1 Metering.GridMs.TotWOut Protocol Identifier Scaling Destination Id-6100-423AD 0,01 Metering.GridMs.TotWIn Id-6100-423AF 0,01 Metering.GridMs.TotWOut Protocol Identifier Scalin g Destination 0x346330 0,001 Metering.GridMs.TotWIn 0x346331 0,001 Metering.GridMs.TotWOut Protocol A Protocol B Protocol C > The SMA Meta Model defines about 2000 data-points > Each data-point has a fixed meaning, type, unit, etc. > It therefore defines the ‘semantics’ of data > A communication driver needs to map its information into the meta-model and vice versa > Using the meta-model has the following advantages: > The data-processing applications can rely on the protocol independent definition of data-points > Information can be mapped between protocols SMA Meta Model
  15. 15. COMMUNICATION LAYER 16.11.2018 18How OSGi drives cross sector energy management, Jörn Tümmler > Integrating different devices is crucial for an energy management system > Different aspects of a communication driver are modeled by dedicated services: Detects devices, creates and removes them One service for each device Enumerates all drivers and visible devices Provided, if a device needs to be polled Provided, if a device can process parameters
  16. 16. DATA PROCESSING LAYER 16.11.2018 19How OSGi drives cross sector energy management, Jörn Tümmler > Data processing is offered at different layers of abstraction: Get notified about any change Get notified about some changes Get notified if schemas change Perform automatic data transformations on update: • Direct mapping • Aggregation • Mapping • Merging • Filtering • Fallback
  17. 17. DATA PROCESSING – VIEW EXAMPLE 20 @Component public class PowerViewExample { interface MyView extends DeviceSchema { @DataMember(id = DataMembers.Measurement.METERING_GRIDMS_TOTWIN_STRING) Double getTotWIn(); @DataMember(id = DataMembers.Measurement.METERING_GRIDMS_TOTWOUT_STRING) Optional<Double> getTotWOut(); } @Reference DataViewAdmin dataViewAdmin; DataView<MyView> dataView; @Activate void activate() { dataView = dataViewAdmin.createView(MyView.class); dataView.onUpdate(this::handleUpdate); } @Deactivate void deactivate() { dataView.close(); } void handleUpdate(DataViewEvent<MyView> event) { System.out.println("TotWin :" + event.instance.getTotWIn()); event.instance.getTotWOut().ifPresent(d -> System.out.println("TotWOut:" + d)); } }
  18. 18. AGENDA 1 2 3 4 What is cross sector energy management? Searching for a solution Getting started with OSGi Getting lost 5 Starting over 16.11.2018 21How OSGi drives cross sector energy management, Jörn Tümmler
  19. 19. FIRST DEVELOPMENT STARTED PROMISING … 16.11.2018 24How OSGi drives cross sector energy management, Jörn Tümmler
  20. 20. FIRST DEVELOPMENT STARTED PROMISING … 16.11.2018 25How OSGi drives cross sector energy management, Jörn Tümmler
  21. 21. FIRST DEVELOPMENT STARTED PROMISING … 16.11.2018 26How OSGi drives cross sector energy management, Jörn Tümmler … but then we got more and more problems …
  22. 22. TOP 5 OSGI PROBLEMS – AND HOW WE DEAL WITH THEM > API design > Dynamics > Whiteboard pattern and lifecycle of listeners which can come and go at any time > Dealing with concurrency issues > Cyclic dependencies > Start order / groups of loosely coupled services ( diagnosis subsystem) > “Service jojos” with optional configurations > Strange resolving errors > Cohesion (“glue bundles”) > Complex configurations 16.11.2018 27How OSGi drives cross sector energy management, Jörn Tümmler > Make APIs as small as possible > Avoid cyclic dependencies; consider WhiteBoard pattern > Avoid own life-cycle methods > Provide a library as dispatcher that handles life-cycle issues > Use immutable data, concurrent data-structures with queues > Combine mandatory w. optional references; register manually > Use the “aggregate state” to configure groups > Only use mandatory configurations > Revise im- and exports > Check the contents of bundles and split them > Split configurations; use JSON as “last resort”
  23. 23. DEALING WITH DYNAMICS - EVENT-DISPATCHER UTILITY CLASS 16.11.2018 28How OSGi drives cross sector energy management, Jörn Tümmler @Component public class WhiteBoardDispatcherImpl { final EventDispatcher<Listener> eventDispatcher = new BackgroundEventDispatcher<>(); @Reference(cardinality = ReferenceCardinality.MULTIPLE, // policy = ReferencePolicy.DYNAMIC) void addPublisher(Publisher publisher) { eventDispatcher.addListener(publisher); } void removePublisher(Publisher publisher) { eventDispatcher.removeListener(publisher); } public void notifyListeners(Event event) { eventDispatcher.dispatch(l -> l.notify(event)); } } @Component public class SimpleWhiteBoardDispatcherImpl { @Reference volatile List<Listener> listeners; public void notifyListeners(Event event) { listeners.foreach(l -> l.notify(event)); } } Problematic Whiteboard Dispatcher Whiteboard Dispatcher with helper class
  24. 24. DEALING WITH DYNAMICS – AGGREGATE STATE 16.11.2018 29How OSGi drives cross sector energy management, Jörn Tümmler More details on http://aqute.biz/2017/04/24/aggregate-state.html @Component(property={"aggregate.state=diagGroup", "diagGroup=conditions" }) @Component(property={"aggregate.state=diagGroup", "diagGroup=logger" }) @Reference(target = "(&(diagGroup=logger)(diagGroup=slf4j)(diagGroup=conditions))“)
  25. 25. AGENDA 1 2 3 4 What is cross sector energy management? Searching for a solution Getting started with OSGi Getting lost 5 Starting over 16.11.2018 30How OSGi drives cross sector energy management, Jörn Tümmler
  26. 26. WHERE ARE WE NOW? > We now have prepared the ground for an extendible system > The first product based on OSGi technology was released in December 2017 > We are currently derive the next products from our framework > Thanks to OSGi deriving new products is now only a matter of configuration 16.11.2018 32How OSGi drives cross sector energy management, Jörn Tümmler
  27. 27. HAS OSGI KEPT ITS PROMISE? After working with technology for three years now the key benefits of OSGi are: > It defines a clean deployment model and versioning scheme for modules > It also defines a life-cycle for modules and components > It enforces API first design > It relies on Java and is therefore hardware independent > It is fast enough to be used on embedded devices > It supports dynamic updates and reconfiguration (although this is a sharp knife) OSGi does not lead automatically better maintainable software – but OSGi helps you to make these issues visible. It requires you to change some of your approaches when designing software. If you are willing to accept this, OSGi is definitely a good choice and can keep its promise! 16.11.2018 33How OSGi drives cross sector energy management, Jörn Tümmler
  28. 28. 16.11.2018 34How OSGi drives cross sector energy management, Jörn Tümmler

×