Python in Climate Tech: Vehicle-to-Grid

Vehicle-to-Grid (V2G) technology addresses the volatility of renewable energy by utilizing electric vehicle (EV) batteries as distributed energy storage. In Germany, the EV fleet provides approximately 150 gigawatt-hours of capacity, which is two orders of magnitude larger than existing stationary storage. This capacity allows the grid to store overproduction from solar and wind sources and discharge energy during peak demand, reducing the need for power grid expansions and preventing the waste of renewable energy.

The approach distinguishes between V1G (unidirectional smart charging) and V2G (bidirectional charging and discharging). To commercialize this flexibility, individual vehicle assets are aggregated into larger blocks to meet the minimum capacity requirements of energy markets. Users define boundary conditions—including minimum and maximum state of charge and departure times—which create a "polygon of charging flexibility." Within these constraints, optimization algorithms determine the most profitable times to buy or sell energy based on spot market prices and weather forecasts.

The technical architecture employs a hybrid language approach. Python handles the majority of the backend and optimization logic. However, because the Open Charge Point Protocol (OCPP) requires stateful WebSocket connections, Rust is used for the charger control layer to provide the multithreading and performance necessary to maintain thousands of concurrent connections. Hardware integration involves industrial Raspberry Pi-based controllers for dynamic load management. Measured data suggests that V2G cycling results in less than 1% additional battery degradation per year, making the service viable for users who receive financial bonuses for providing grid flexibility.

This description was generated by Open-Source AI using the transcript of the session and the original submission contents.

This session took place in track Others and was classified suitable for novice python by the speaker.

Submission

The proposal as submitted by the speaker before the conference.

At The Mobility House Energy, our mission is to enable a zero-emission future by connecting the worlds of mobility and energy. By intelligently integrating electric vehicle batteries into the power grid, we unlock flexibility that supports renewable energy expansion, enhances grid stability, and makes electric mobility more accessible and affordable.

In this talk, we share how Python became a key enabler on our journey to delivering Vehicle-to-Grid solutions at scale. From early simulations and prototyping to operating production-grade energy systems, Python supports us across the entire development lifecycle. It allows us to rapidly validate ideas, process and analyze complex energy and mobility data, and deploy robust services that are battle-tested in the real-world and on energy markets.

We will also explore how adopting Python in production reshaped our collaboration model. Data scientists and software engineers now work closer together, sharing tools, codebases, and responsibilities. At the same time, we will openly discuss the technical and organizational challenges we encountered—from performance bottlenecks to system integration—and the practical solutions that helped us overcome them.

Transcript (auto)

Auto-generated from the recording utilizing Open-Source AI. Speaker labels (Speaker 1, Speaker 2) reflect diarization, not identity. Timestamps refer to the recording.

Speaker 1 [00:03]

Okay, hello everyone and welcome to this talk by Christopher. Christopher is part of the Mobility House where they are working on the integration of vehicle batteries into the electrical grid, I guess. And he's going to talk about Python and Climate Tech, vehicle to grid.

Speaker 2 [00:23]

Well, thank you very much. Nice to be here again. We've been here two years ago. Well, not here, but back in the time in Berlin. And back then we were talking a little bit more broadly about what we do. Today I'm just specifically focusing on vehicle-to-grid. And first of all, also who we are, because it's not 100% right. I'm from the Mobility House Energy, actually. So since back then, we split into the subdivisions. So that's what I'm going to talk about first. Then I want to tell you about our vision, our mission. Why actually do we do that? even though it's kind of omnipresent, the topic currently in the news and the media. And then I want to dive deeper into what is VGI, what is V1G, what is V2G, because those are terms usually people deal with then if they dive into this topic of bringing batteries onto the power grid and then also give you a little bit of a glimpse because it's just roughly 20 minutes of what our tech is and what we use. So, who are we? We are the Mobility House. It's a group of divisions of companies. We are in the middle, charging. It was basically how we started, reselling wall boxes, because 15 years in the past, the market was quite different. we basically resell hardware to home customers but also to businesses we also provide installation services and help with that we also since I think it was last year have the charge line in our portfolio our own wall books but that's charging that's how we started Then, usually, customers get bigger, the market got bigger, fleets came up, and as such, also solutions, our solutions business, where we also developed the ChargePilot, which is also heavily Python-based, even runs, if you look closely, probably you cannot see it well from the back, it's an industrial Raspberry Pi, so probably familiar to a lot of you here. and the charge pilot is basically dynamic load management so on-site if you have a lot of cars charging in parallel usually you blow the fuse and charge pilot is here to prevent that has a lot more features than that but that was basically the basic need with which it started. We in the energy we provide electricity as an electricity supplier at least in certain markets but also we commercialize flexibility on the market. Flexibility means that something on the market, somewhere on the power grid, attached to the power grid, can either consume or actually give power back to the power grid. And we focus on stationary as well as on mobile assets. So basically, as i always say it we focus on batteries with and without wheels so without wheels those are stationary storages i will not talk about that much today just here mentioning them because we have quite a lot of capacity there also under management in operation in the real field several hundred megawatts, I today want to focus on vehicle-to-grid in our domain, in the energy. Our vision and mission, why actually do we do that? It's a statement, which is quite bold, zero-zero. What does it actually mean? We want to enable people, we want to enable everyone to charge their electric vehicles at zero cost and and thereby causing still zero carbon emissions. So we want to work towards an emission-free future. And one of the cornerstones for that, of course, are renewables. And we are currently in a transition phase towards it. And here, a study from 2022, where they analyzed the growth predicted the growth probably already outdated and probably in recent studies you would see a little bit of a bigger growth and the remarkable thing I want to point out here it's comparing 2022 to 2030 it's roughly tripling the power we have available through renewables however Every one of you knows how renewables work. You need sun, you need wind, and then if you look at how the public net electricity generation in Germany is here, a picture from back in 2024, well, they cause problems. They are flexible, kind of. If there's a cloud over a solar plant, well, it's not producing that much anymore. That's something we have to cope with on the energy markets. And thus, this increase in volatility needs to also an increased need in flexibility inside the system. So we need to be able to somehow store the overproduction, but also give it back to the grid. So there is already technologies for that, but try to build a lot more hydropower plants. That's not going to work. They are huge. They take a lot of space. Well, you can debate over whether they destroy nature or not. But you need a lot of rivers for that. Batteries, they're a lot easier to use. And, well, I'm not sure how many EV drivers we have here, but in Germany, end of 2025, we already had around about 3 million cars here out on the streets. If you do the rough math, actually, assume a capacity of around about 50 kilowatt hours, you end up at 150 gigawatt hours. And, well, that's also what studies show. We have a capacity with EVs alone of 150 gigawatt-hours. That's a huge lot. That's a huge battery. And here, as a comparison, the stationary storages, which are usually a lot of batteries packed together on just one place, they don't have wheels anymore. It's two orders of magnitude less than actually for cars. That's two orders of magnitude, so we don't have that much capacity available in form of stationary storages in Germany currently. That's a problem because we still need to store that energy. Currently the solution often is, well, turn it off if we have an overproduction. That's not good. We shouldn't waste that energy. And if we look at the predictions for 2030, well, it's going to double. That's quite a number, going from 150 gigawatt hours to 300. So that's a capacity we should use. We should put to action and not just leave it standing there 90% of the day being wasted. Because that's actually what cars usually do. of the time they don't drive around, they stay. However, there's one complaint or one fear which often comes up. Cars come back home and then they get plugged and then they start charging. Yes, that usually could become a problem. However, that's also then where true vehicle grid integration comes into play. Instead of just having them blindly charge, shift the charging, you manage it towards times which suited better. And that's also what I wanted to show you now a little bit more into detail what is in the year for the individual parties. So most of the cars as you know probably they currently just can't charge. They are from the hardware side not capable of discharging the battery other than by driving. That's what we call V1G. So basically the only service to the grid you are providing is you can consume overproduction. But that's already very, very helpful because then your car doesn't charge in times where there's a huge stress and strain already on the grid. If now, however, your car can also discharge, that's what we call then v2g so then we can actually also in times where there's a huge stress on the grid discharge the car to support it thus also reducing the need for extensions of the power grid because you have it local you have it there it's not like you need to deliver it still from yet another coal power plant or so to your home. Instead, it is the most local and easy thing to do. And the value chain basically is that the users provide the power grid with flexibility. Flexibility for storing or giving back energy to the power grid. This flexibility in the first step on our side is aggregated Because one car alone, I'm not sure how many people out of the energy business are there, but usually trades on the energy market start at far more than just the few kilowatt hours you can do with your car. So you need to build aggregates which are also useful to the energy grid. And then, of course, we trade it. It's a quite active market if you go to the short-term market, which is actually where the flexibility lives. And then, of course, the users also get paid back. That's the value they get. For providing flexibility, which is an asset for the market, they get value back in the form of money. How does it look like if you then are a customer? How does the customer journey look like? So here, for the example of Renault, we partnered up with Renault and together launched more than a year ago the first full V2G offering in Europe. It's working and it's in production, so V2G is not a dream anymore. first of all the person goes to a car dealer makes the decision to buy a car which also is capable of doing V2G so charging and discharging then of course you also need to have the appropriate wall box which currently luckily is also in the package available and then of course you also need the correct tariff yes we could also do smart charging for the customer with other terrorists just optimizing the charging of the car but the users wouldn't get anything back from that and that's usually well you don't want to provide just an asset just for providing it and not getting anything back because still it's work on the battery it consumes a little bit of the lifetime of the battery and not getting anything in return for that I guess that's also a little bit of unfair you could even say and then the customer of course needs to activate v2g in the app there are some settings then you need to set what is minimum state of charge because it might be that there's an emergency at the school you need to pick up your kid that battery would be drained empty the car is of no use to you which would leave us with a lot of unhappy customers which would never again use v2g or something similar and therefore there's the minimum state of charge the maximum state of charge and also your departure time when you at least expect to leave next and that's parameters we then operate the battery in and generate value both for the grid as well as also for you with the asset you're providing to the grid and then of course the customer even might charge for free in the future hopefully. We also have solutions for v1g where the then here in Germany for example with the E.ON tariff provide also options for people who just have v1g available and we all know Germany we don't also have that many smart meters available which are also for v2g very very important you basically also have an app which then the back and our back and this the optimization of your charging sessions which also takes into account the prices at the spot markets and all your mobility needs so that's always the most important point for us if the customer becomes unhappy, V2G, Vehicle Grid Integration, VGI, V1G, however you want to call it, is of no use. Then we have the electricity tariff, because if we don't have a contractual relation, no one gets anything in return. And of course, as a component, also the flexibility or the bonus payout then. Maybe a little bit on the tariff. You know, there are the usual German flat tariffs, but also dynamic tariffs. On the flat tariff, you usually don't take the risk. You have something you can calculate with that's fixed for until whenever, usually for a year or so. On the dynamic tariff side, you take the full risk. If the market goes crazy, you can either earn a lot, where you can lose a lot, and our solution is, well, not kind of in the middle, it's still a flat tariff, but you get additional money paid back, so that's how we try to provide users with a risk-free approach to V1G and V2G. However, all in all, V1G, vehicular grid integration, V2G, they pose a lot of challenges. Of course, the fear of battery degradation is real. However, if you operate them within boundaries, it is usually fine. The degradation is found to be not much more than they either way would be, because either way, you would charge your car, wouldn't you? I at least would, because I want to go someday. so there the effect on the batteries are less than also anticipated and expected and on the other hand however hardware is currently still a problem we have just a limited selection of v2g cars and car makers available also the charger compatibility well it's not yet all plug-and-play so offerings like with Renault are still needed. It will still take some time even though there are standards like the OCPP standard which usually should provide us with a little bit of safety but as it is with standards usually everyone interprets them differently. Then there's of course the cost factor EVs are still at least the European ones quite expensive and regulatory we still have a bit of uncertainty. Luckily, at least in Germany, double taxation has been abandoned finally. But the other downside in Germany still is smart meters. We're missing them. There are two ways basically to control the cars, usually via the charger or via mobile network. That, of course, also poses challenges in data quality and frequency. You have to do a lot of data cleaning we observed cars driving around in the streets having a bug where it's none said the car was charging which just wasn't true it wasn't at home it was driving on the streets and the position data supported that and the driver as well forecasting of course for us is very crucial and important weather forecasts how sunny is going to be that also has an impact on the energy prices and of course then the user behavior because the users well they are the most unpredictable thing to us whether they unplug early or leave the car plugged for another 20 hours that's not under our control and then of course you need to orchestrate the whole system all these distributed assets aggregate them and disaggregate them again because also you have to fulfill what you promise on the markets and then of course testing on energy markets that's not very easy because they are energy markets a lot of people take place you don't have a controlled setups and especially talking about a controlled setup you also have home energy management systems which which might intervene the decisions you took on the other end, so it's better to integrate that. Then, lastly, a little bit about our tech. How did we approach those problems? How did we solve them? And there's a plethora of technologies involved, and yes, it involves Rust, Python, as well as also others, Flutter mainly then also for the app. But for you probably more interesting is how did we tackle the optimization problem actually? How do we think about charging? Well we usually think in terms of boundary conditions, what we call the polygon of charging flexibility. We take as inputs what the user gives us. Basically the minimum state of charge, the maximum or target state of charge, and then We also need to think about charging and discharging. They might have different efficiencies, and that's also what we need to model. And this basically gives us boundary conditions in which we can operate. First of all, it would be that the user discharges or the car discharges as soon as possible, then waits, and then as late as possible charges to the desired state. On the other hand side, the other boundary would be to charge as soon as possible to actually 100% then leave the car there and then go down by discharging to the target state and within that boundary we have a lot of flexibility where we then interact with the market and then try to optimize what is the best buy or sell decision to take and to make. Our hardware, not hardware, our architecture, we try to keep it tidy by splitting it into domains which are quite, well, domains also in a business sense, to keep our services cleaned up. But also within the domains then choose the technologies which are appropriate for the the task at hand, and who of you knows OCPP, anyone who knows the details about the protocol or at least roughly what it is? No one. Well the thing is OCPP is a stateful connection opposed to what we usually deal with in the the cloud systems with stateless connections, we have to keep the web sockets open all the time, which of course, well, Python is not the most suitable tool always for that. There are nowadays a lot of improvements in the most recent versions, but that's the part where we said we need Rust. We need something more performant, which can keep a lot of connections open and parallel process the data in a speedy manner whereas all the rest for us most of it is Python so here when we try to control the chargers we ended up in a dead end kind of with Python we were quite well at least in terms of resources meaning computing resources, it was intense. And that's where we said we switch to something which is truly multithreaded. And that's where Rust helped. There were some other things which also helped. The one lesson we learned there is have a lot of tests. That usually helps on such a migration project quite a lot. If you ever transfer something to Rust, build your safety net. Having a huge test coverage makes that usually quite easy. It was a huge project, but with the safety net, we had nearly no regressions at all. If ever you're in the same position, think about first, invest that time into your tests and then do the migration. Don't do the tests while migrating, that will just screw you up. Right, with that, thank you for your patience, thanks for listening, and any questions?

Speaker 1 [24:22]

Thank you, Christopher, for the nice presentation. You mentioned you have also some optimization problems, and I went to Gorobi before, and I think they're all in on optimization, so maybe there could be a collaboration between you guys.

Speaker 2 [24:38]

We actually have also people who worked a lot with groby companies They are known to us

Speaker 1 [24:47]

okay so let's proceed with the questions so you mentioned people are certainly an uncertainty factor in the whole system so the first question is how to prevent that early in the night my car charges my neighbor's car and later in the same night my neighbor's car charges my car back

Speaker 2 [25:09]

Well, I'm not sure whether that's a nightmare, that's how markets work, but indeed, considering it from an energy, well, from the degradation perspective, it's not nice. What we do there, we have certain cycling limits to prevent this feedback loop from appearing. So we try to just have one, I think it was one cycle a day or so at most. So we reduce the cycling time and thereby these feedback loops between neighbors.

Speaker 1 [25:47]

Okay, second question, if everyone in Germany is having a V2G car with the same similar algorithm to determine when to charge and to discharge, how does the algorithm determine which cars to charge and discharge?

Speaker 2 [26:03]

We currently prioritize them actually by the departure date, plus then also the boundary conditions, which were shown right here, because you know where you are in the time frame. So from left to right, you have the time. And if you then are at this dead end where you just have to charge, then it's for us something we have to fulfill kind of now.

Speaker 1 [26:35]

Okay, are there any studies on the impact of vehicle-to-grid on the battery lifetime and what hidden costs this is equal to?

Speaker 2 [26:47]

Yes, they are. And if I remember correctly, the degradation per year is actually less than a percent from the additional V2G cycling.

Speaker 1 [27:06]

Okay, thank you. Are there any other questions in the audience?

Speaker 2 [27:24]

Connection between what?

Speaker 1 [27:34]

Wireless.

Speaker 2 [27:35]

So basically the question was what's the connection here between the chargers and our cloud applications REST applications and the charging stations are connected usually by a LAN or wireless LAN to the internet and Then it's a WebSocket connection to us and the protocol they are speaking is OCPP usually

Speaker 1 [28:04]

The other thing about business side, how can

Speaker 2 [28:06]

how can your company make profits from VGG offer? So we profit a lot from them selling and buying energy at the right time. So currently that's a time where you should buy energy. It's sunny outside, we have a lot of production, and then usually manage the charging such that we would discharge when people get home. And their energy prices are usually higher because people turn on their TVs, washing machines, everything. and consumption usually then rises up okay thank you for the talk those

Speaker 1 [28:49]

Those V2G cars, such as the Renault one, can they also be used to directly power...

Speaker 2 [28:55]

directly power stuff in my house? Yes and no. So that's then what's called a vehicle term. The thing is, if you discharge your car, usually you don't have so much control over where does the power exactly go in the system. That's just physics. So that's hard. However, with a home energy management system, you have better control and knowledge about what is going on in your home. Because for us currently in the state we are in, that's the missing piece of information. We just have the final output of the smart meter. And that's usually, it's just a guess what is going on in the house. And to make better predictions, you would need to disentangle PV from the car and the other stuff to then say, OK, wait, he's going to come back at eight. Then we discharge the.

Christopher Sedlaczek-Bock

About — in the speaker's own words

After finishing my PhD in high energy physics, I worked as software developer and as solution architect on projects in various industries. In the end I ended up at The Mobility House Energy, because I want to work towards a zero-zero future. Nowadays I am working as the Head of Tech VGI.

Social card for talk: Python in Climate Tech: Vehicle-to-Grid