The art of simulating and optimising cyber-physical systems

Remember these words: Modelica, OpenModelica, Optimica and JastAdd. Ten years of collaboration within ELLIIT between researchers in Lund and Linköping, and between academia and industry, have made it considerably easier to simulate and optimise complete cyber-physical systems.

Cyber-physical systems are embedded systems that are used in the physical world: cars, aircraft, telecommunication equipment, robots, manufacturing equipment, equipment used in medical care, and various consumer products. All cyber-physical systems consist of a complex mixture of, for example, mechanical components, electronic circuits, software and hardware.

Researchers Görel Hedin and Johan Åkesson from Lund University and Peter Fritzson from Linköping University have collaborated within ELLIIT since 2010. They have worked in several research and development projects for simulation and optimisation using Modelica, an object-oriented language created at the end of the 1990s.

Professor Peter Fritzson from the Department of Computer and Information Science at Linköping University, working with colleagues, wrote the first formal specification for Modelica, and in 1998 founded a company, MathCore AB, to provide implementations based on Modelica. In 2002, he took the initiative to OpenModelica,an open-source implementation that researchers and industry can download and use free of charge.

In order to support the development of the tool in the long term, he also took the initiative to forming the Open Source Modelica Consortium, a non-profit society that now has more than 50 member organisations from both the academic world and industry.

The Modelon company was founded in Lund in 2005, as a spin-off from the Department of Automatic Control. Its business idea was to develop libraries for Modelica, and it found its customers mainly within the automotive industry.

Görel Hedin, professor of software technology in the Department of Computer Science and her group developed new techniques that made it simple to create a compiler that translates code in a high-level language to a low-level language, such as machine code. The researchers incorporated the techniques into JastAdd, an open-source tool that they also used to develop a Java compiler.

“The tool is used to describe the desired tasks of the compiler at a high level, using equations, and the compiler is then generated from the description. We chose Java, but the technology is generally applicable and works for other complex languages such as Modelica”, says Görel Hedin.

Johan Åkesson was at the time a doctoral student in automatic control at Lund University, and found the tool highly useful in his thesis work. He used JastAdd to extend Modelica with support for optimisation, and in this way created Optimica. Previously, the software had been able to simulate, for example, a car driving around a track: now it could also optimise the car´s speed and the path chosen through a curve. Johan Åkesson moved to work full-time at Modelon in 2013 with the Optimica Compiler Toolkit simulation software package, which is now an integral part of Modelon’s range.

The art of simulating and optimising cyber-physical systems Remember these words: Modelica, OpenModelica, Optimica and JastAdd. Ten years of collaboration within ELLIIT between researchers in Lund and Linköping, and between academia and industry, have made it considerably easier to simulate and optimise complete cyber-physical systems.

“We will continue our long-term collaboration with Modelon”, Görel Hedin confirms.

A further step was taken a few years ago when the groups involved with Modelon in Lund and OpenModelica in Linköping joined other European partners to collaborate in the development of FMI, which is today a prize-winning standard in enabling different tools to work together. FMI has also been adapted for industrial use.

“FMI makes it possible to simulate one part of the system in Modelica and another part in another simulation package”, Görel Hedin explains.

OpenModelica and the Optimica Compiler Toolkit are today well-established products that are widely used in both academia and industry. OpenModelica is used in many commercial products all around the world by, for example, ABB and Bosch-Rexroth. MathCore has changed its name to Wolfram Mathcore. It now has around 20 employees and is part of the Wolfram Group.

The Optimica software has enabled Modelon to grow in recent years from 15 to 80 employees. In 2020, the company launched a cloud-based platform, Modelon Impact, for simulation and optimisation, which makes it possible to carry out large-scale parallel computations in the cloud.

Work with JastAdd continues in the research group at Lund University, and the software is also used by researchers all over the world. It is used by, for example, ABB to develop compilers for control systems.

“This shows the huge value of a long-term and close collaboration between the academic world and industry, in which we gain new research questions from industry and our research contributes to industrial development”, says Görel Hedin.

Research Group

Research

Görel Hedin, professor of software technology in the Department of Computer Science, Lund University, leads the work with JastAdd, in collaboration with several junior researchers and doctoral students. Peter Fritzson, now professor emeritus from the Department of Computer and Information Science at Linköping University, works together with Docent Adrian Pop, Docent Lena Buffoni, and several junior researchers and doctoral students. Johan Åkesson is docent in the Department of Automatic Control, Lund University and CTO at Modelon.