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.

Physikal - Using Kotlin for Clean Energy - KUG Munich

54 views

Published on

Tenkiv developed a new kind of solar power system focused on cost-effectiveness and scalability in need of data acquisition system to collect and analyze data from different sensors throughout the cloud. Because the system may have different energy conversion devices (modules), different number of thermal circuits, collectors, etc. the control software has to be very adaptable to match these varying configurations.

Therefore the JVM was an ideal choice. The control software "Nexus Brain" is written in Kotlin. It heavily uses Units of Measurement, so Tenkiv created Physikal, a Kotlin extension to the Java 8 implementation of JSR 363. A project also used by others, for example in collaboration with NASA or ETH Zurich.
This session will give a brief overview of how Tenkiv and Nexus Brain use Kotlin and Physikal/JSR 363 to calculate the optimal usage of alternate energy sources and control solar power systems for making clean water anywhere from Flint Michigan to Afghanistan or Cape Town.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Physikal - Using Kotlin for Clean Energy - KUG Munich

  1. 1. Physikal – Using Kotlin for Clean Energy Werner Keil, Director, Creative Arts & Technologies Kotlin User Group Munich June 20, 2018
  2. 2. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Agenda 1. Introduction 2. Tenkiv Nexus 3. JSR 363 4. Physikal
  3. 3. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Who am I? Werner Keil • Consultant – Coach • Creative Cosmopolitan • Open Source Evangelist • Software Architect • Spec Lead – JSR385 • Eclipse UOMo Project Lead [www.linkedin.com/in/catmedia] Twitter @wernerkeil
  4. 4. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Save Water
  5. 5. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Water Crisis
  6. 6. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI The Globe 2.5 billion people across the globe lack access to clean water.
  7. 7. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Developing Nations In places like Afghanistan, lack of access to water sanitation leads to a 1 in 5 child mortality rate.
  8. 8. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI California 98% of California is experiencing severe drought, placing major stress on our water infrastructure.
  9. 9. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI South Africa Cape Town is experiencing a severe drought. It could only avoid running out of water by restricting water usage to 50 litre per person and day. In 2016, average daily per capita use in California was 321 litres.
  10. 10. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is Tenkiv Nexus? The Tenkiv Nexus is a fully modular renewable energy system. It uses heat from the sun in order to power anything for 1/13th the cost of existing solar panels and 1/5th the cost of fossil fuels without any subsidies. It’s the breakthrough the world’s been waiting for that finally enables us to truly utilize the most abundant source of power available on earth: the sun. Tenkiv started deployment of the Tenkiv Nexus for water purification, but over time will replace more and more of the world's dying energy infrastructure with this new, more powerful, cost-effective, and completely clean energy nexus.
  11. 11. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Tenkiv Nexus
  12. 12. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is JSR-363? Munich San Francisco 5,858 miles A Quantity A Unit 9428 km Distance between Munich and San Francisco
  13. 13. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Why do we need JSR-363? There are no specifications or standards for handling units in Java. The current solution is to use primitives, that don’t provide any Type Safety. The errors are difficult to find using unit testing: Interface and Internationalization (e.g. radian/degree, meters/feet); Arithmetic operations (e.g. overflow); Conversion between units (e.g. from same domain);
  14. 14. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI 5,858 miles A Quantity A Unit 9428 km Distance between Munich and San Francisco What is the problem, in code? int distance = 5858; //in miles float speed = airplane.getSpeed(); //in km/h System.out.println(“TTD: “ + (distance/speed) + “ h”);
  15. 15. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is JSR-363, in code? Quantity<Length> distance = Quantities.getQuantity(5858, USCustomary.MILE); Quantity<Speed> airplaneSpeed = airplane.getSpeed(); System.out.println(airplane + " flying at " + airplaneSpeed); Quantity<Time> timeToDest = distance.divide(airplaneSpeed).asType(Time.class); System.out.println(“TTD: “ + timeToDest.to(Units.HOUR)); Airplane [A380] flying at 945 km/h TTD: 9.97622180949874 h
  16. 16. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI The SI Standard will be revised in May 2019 The General Conference on Weights and Measures (CGPM) is expected to approve SI reforms in November 2018 SI Roadmap
  17. 17. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI • JFK was elected US President • Real Madrid won European Cup 7:3 against Eintracht Frankfurt • Brasilia becomes Capital of Brazil 1960
  18. 18. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI • Because the new SI Revision is the most significant change to the Metric System since it was introduced in its current form 1960, this was a key reason to increase the version number to Unit API 2.0. • Another argument is adopting to a rapidly changing Java Platform and Runtime which itself tends to increase the major version of the JDK twice a year now. • Time and the community will tell new requirements beyond that, but it is likely Units of Measurement 2.x should be the standard for at least the 2020s or beyond. Motivation for JSR-385
  19. 19. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is Physikal? Library providing Kotlin extensions and ease of use functions for Java Units of Measurement libraries based on JSR-363. Contains • Core - Basic Metric units. • SI-Units - SI units. • Complete-Units - All units including US or Imperial.
  20. 20. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI
  21. 21. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is Physikal, in code? Create Units val added = 10.metre + 1.kilo.metre >> 1010.0 m val small = 10.metre val large = 10.kilo.metre
  22. 22. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is Physikal, in more code? Includes all operators val added = 10.metre + 1.kilo.metre >> 1010.0 m val speed = added/10.minute >> 101 m/min var aFewSeconds = 5.second aFewSeconds++ >> 6.0 s 10.peta.watt > 2.watt >> true
  23. 23. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI What is Physikal, in more code? Using different units (SI units & other units) 5.gram + 2.pound >> 912.18474 g (13.kilo.gram + 20.pound) convertTo STONE >> 3.47572100600243466674378 st
  24. 24. © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI Links Public JSR-385/363 mailing list(s) and/or forum(s) Units-Dev on Google Groups Units-Users on Google Groups JSR-385 page: https://jcp.org/en/jsr/detail?id=385… Project Website: http://unitsofmeasurement.github.io on GitHub Tenkiv: https://tenkiv.com Physikal: https://github.com/Tenkiv/Physikal
  25. 25. @YourTwitterHandle#DVXFR14{session hashtag} © 2017-2018 Creative Arts & Technologies and others. All rights reserved.#Physikal @UnitAPI

×