Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Edge to Cloud: Building the Tesla Virtual Power Plant

Edge to Cloud: Building the Tesla Virtual Power Plant

This item in japanese

Recently at QCon London 2020, engineers from Tesla discussed the Tesla Virtual Power Plant, and explained how the software they are building is tackling some of the hardest problems in distributed computing and in renewable energy. The talk was a 50-minute deep dive into how Tesla is leveraging IoT, edge, cloud, and reactive architectures.

The Tesla Virtual Power Plant (VPP) is a modern example of a cloud-native architecture that leverages edge computing. Built to the demands of the ever-changing energy market, the system shows how a reactive architecture with edge telemetry and command/control of edge devices enables a platform to handle the dramatic fluctuation found in the peaks and valleys of the energy market.

The energy market, without the ability to easily store capacity of its own, must be adjusted to match supply and demand for power consumption. This control has been traditionally achieved by increasing or decreasing the output of power generation plants. Without the ability to control this, markets face brownouts, damage to infrastructure, and heavy cost overruns. With the introduction of smaller renewable energy sources, the ability to adjust and control the market is becoming more challenging. VPP is software that enables energy market participation through aggregating small providers.

The VPP uses a cloud-based platform to provide a resilient message-driven system that leverages reactive streams to forecast and control edge devices such as those found in a consumer’s home. VPP does this in the face of network partitions, heterogeneous configurations, and the dynamic needs of the energy market.

Tesla VPP architecture

A central concept enabling the forecast and control of the edge devices are “digital twins”. During the session, the co-presenter Colin Breck, senior staff software engineer at Tesla, described the concept of digital twins as:

[...] a physical representation of an IoT device (a battery, inverter or a charger) that is modeled virtually in software. He went on to say this is used to “model and represent the current state” of the devices and their relationships.

The system and the digital twins are modeled in the cloud using an actor model on top of Akka. Akka, created by Lightbend, is an open-source toolkit for the JVM that simplifies the construction of concurrent distributed applications. While Akka provides the fine-grained mesh on which the platform operates -- providing features like immutable message passing, circuit breaking, and retries -- Kubernetes is used for coarse-grained service control, as it offers functionality such as the elasticity, resilience, and availability provided from its container orchestration engine. In addition to Akka and Kubernetes, the platform leverages Akka Streams, Alpakka to interface into the Kafka cluster that ingest the telemetry from millions of IoT devices, and a polyglot environment of 150 microservices, the majority of which are written in Scala.

Leveraging the infrastructure provided by the platform, the team built "Autobidder", the application that makes predictions and pushes out recommended control plans to edge devices that have opted into the Tesla service. Using a process that co-presenter Percy Link, staff software engineer at Tesla, called co-optimization, the needs of the local device owner and the needs of the overall market are addressed at the device level. Co-optimization works to address the needs of the overall market with the goals of the individual consumer.

During the presentation, Breck and Link went through the architecture of the energy platform. They covered lessons learned reacting to the energy market using a single battery (the Hornsdale Battery in Australia), how they were able to forecast and shave energy peaks, and then finally dived into the details on how Autobidder is able to participate in the market in real-time using this architecture. Along the way, the two distributed systems engineers highlighted takeaways for senior developers that they discovered through building the application and platform. Some of these lessons included: embracing reactive principles, learning constraints that liberate (not limit) developers, following a paved path for technology choices, and managing complexity at the boundaries.

The talk was an excellent example of a modern reactive system that leverages telemetry and command/control of edge devices coupled with expert-level guidance on building distributed systems. The Tesla Virtual Power Plant will be in one of the first batches of videos published online from QCon London. Check back in the coming weeks to see the full presentation online.

Rate this Article