Karl-Olof Lindahl

At Otto’s farm, AI is used for sustainable energy supply

JANUARY 2026 | With his research in artificial intelligence, Karl-Olof Lindahl aims to create real-world value here and now. Such as helping farmers strengthen their finances through renewable energy. At the same time, he wants to contribute to the development of AI at a more general level, where his research group can outperform both Google and Microsoft in certain areas.

Otto Hadvall stands watching as Karl-Olof Lindahl installs a new meter in the meter box on his farm, Fredrikslund, south of Kalmar in the Småland region of Sweden. Here, Otto produces more electricity from biogas than the farm consumes over the course of a year. Yet he still has to buy large amounts of electricity to keep daily operations running year-round, which is, of course, a waste of both energy and money.

Otto Hadvall climbing his biogas tank
“This is a very exciting project that will hopefully help many small‑scale entrepreneurs and energy producers make the best possible use of their self-produced ‘green’ electricity!” says Otto Hadvall.

The solution is spelt AI – artificial intelligence. In projects funded by the Municipality of Kalmar and the Kamprad Family Foundation, Otto’s annual electricity costs are to be transformed into a potential profit from renewable energy. This will be achieved through solar panels, batteries for energy storage, and intelligent control of the electrical systems – all based on AI.

“For me, as someone who’s really driven by development, it’s incredibly stimulating to work with Linnaeus University. Karl-Olof and his team present one exciting solution after another for the energy system in my business. I’ve already had answers to many of my questions and concerns. Used in the right way, AI will be an enormous help”, says Otto.

Karl-Olof, who says he has always been an explorer and problem-solver, has been particularly passionate about the project from the very start.

“It felt like we were onto something big here. I can use my expertise, we’re going to create real value, and it’s going to be fun. It’s never been so easy to write an application!”

Artificial intelligence in agriculture

The purpose of Karl-Olof’s research is twofold. One aim is to develop new, smart AI models and algorithms at a general level.

“But also to push the boundaries of what the applications can do. We want to see AI in action, working with real data in real contexts. We want to contribute tangible value for individual users.”

Karl-Olof Lindahl

Professor of mathematics

Karl-Olof Lindal in front of the meter box

Even as a doctoral student, Karl-Olof Lindahl was interested in how we process information and make decisions. Since then, he has conducted research in dynamical systems, number theory, machine learning, and AI. He is also the programme coordinator for the Master of Science in Engineering programme in engineering mathematics.

FUNDS GRANTED SINCE 2023

SEK 6.5 million
Funders: the Kamprad Family Foundation, the Municipality of Kalmar

A clear illustration of how Karl-Olof’s research can be applied, then, is in agriculture. Energy costs are high here, so many have invested in solar panels or in facilities to produce biogas. At the same time, they find that they are not realising the full potential.

“There’s a need to optimise their systems – how energy is used and consumed, but also how it’s produced and sold. Because the idea is that their surplus should be sold – and at the best possible price.”

Optimisation using AI operates at two levels. One is an overarching level that recommends equipment and storage capacity and suggests possible modifications to production, operation and maintenance. The other is a practical level that optimises the system to make full use of the equipment.

“For this, we’re developing a programme that regularly collects measurement data and uses it to control storage and other functions. You have to work at both of these levels to maximise results.”

In mathematics, the time from idea to application can be several years. In AI, it may be only a matter of weeks.

Karl-Olof Lindahl

Towards sustainable and robust energy systems

What Karl-Olof and his research group are working on can be summed up as “long-term sustainable energy supply”. Reducing the need for new energy and instead using existing energy more efficiently. Similarly, redistributing energy within systems so that society becomes less vulnerable to disruptions. In addition to agriculture, this can also involve areas such as hydropower or district heating.

It also involves what is known as island mode – the ability to operate for a period without being connected to external grids, which is also important from a crisis preparedness perspective. For farms, but also for society as a whole.

“There’s also a democratic aspect to this. Being able to help small-scale energy producers earn money when electricity prices are constantly fluctuating. This makes them less dependent on the outside world and on political decisions concerning tariffs, taxes and capacity charges.”

That size is not everything also applies to the research group. Giants such as Google and Microsoft invest enormous sums in research and development in AI, with large teams and vast computing power.

“But a couple of years ago, we – three researchers at Linnaeus University with far more limited resources – sat down and managed to produce code that became world-leading in a specific area of AI. That proves we’re holding a winning hand: we have many PhD mathematicians, and the field is strong and well developed here.”

Otto Hadvall and Karl-Olof Lindahl in front of the meter box

AI as an adviser

So mathematics is a key to solving many of today’s and tomorrow’s problems. With the help of AI, abstract mathematics is turned into concrete solutions, as on the Småland farm.

AI to optimise forestry

Artificial intelligence can be used in practical ways across many different fields. Karl-Olof Lindahl also works with Nils Fagerberg, who did his doctorate on what is known as continuous-cover forestry. They are recreating Nils’s research in digital form and, using AI, they can simulate the consequences of different harvesting strategies. Together, they are seeking answers to questions such as how much forest, and which trees, should be harvested each year in order to optimise yields.

However, AI is not a cure-all, Karl-Olof points out. For him, AI is ultimately a tool we can use a bit like an adviser, based on our common sense.

In artificial environments with simple, clearly defined rules, such as chess and Atari games, AI outperforms humans quickly and easily. In the real world, however, there are many uncertainties in the measurement data that influence results.

“I’m struck by just how extraordinarily data-efficient we humans are. With very little data, we often make very intelligent decisions and can handle a bike or a car intuitively. Quite incredible!”

But whether we like it or not, AI will play an ever greater role and become increasingly powerful.

“I choose to believe in AI and in humanity – that the majority of those working with AI, and in society at large, want to do good. But it’s very important that as many people as possible get involved, so let’s all help shape AI and keep it on the agenda – in academia, in politics and in society.”

Otto Hadvall feeding his cows

Mathematics – a prerequisite for all AI

The foundation of all artificial intelligence is some form of optimisation combined with statistics and probability theory. In these areas of mathematics, Linnaeus University has a long tradition.

“We're particularly interested in what is known as sequential decision-making, where the goal is to maximise the utilisation or the profit of something, or to minimise a certain cost”, says Karl-Olof Lindahl.

Sequential decision-making means that data is evaluated repeatedly, always with a long-term perspective. Like asking yourself every day, “Is it time to buy a new car or not?”. It could apply to a stock portfolio, or to a robot that must continuously make decisions on how to move as energy‑efficiently as possible, considering what it is supposed to do.

“Practically speaking, we work a lot with energy optimisation, which involves making decisions such as whether to charge or not charge a battery, whether to sell or not sell electricity within a system, or how electricity should be redistributed inside that system.”