Skip to main content
Back

Hamburg University's Flowcean Unifies Robot and Power Grid AI Into One Python Framework

A new open-source Python framework unifies offline, incremental, and active learning pipelines for cyber-physical systems under one modular architecture.

Pro

  • Flowcean is a new open-source Python framework for automatic model generation targeting cyber-physical systems, released under BSD 3-Clause.
  • It unifies offline, incremental, and active learning under one modular pipeline with swappable environments, transforms, learners, and metrics.
  • Ships with loaders for CSV, JSON, Parquet, YAML, and ROS bag files, plus a gRPC bridge to non-Python libraries like LearnLib.
  • Integrates PyTorch Lightning, scikit-learn, and regression trees; swapping learners in a pipeline is a single-line code change.
  • Case study on a non-linear water tank ODE shows a regression tree beating an MLP at 0.0206 vs 0.0639 MAE.
  • Available on GitHub and PyPI, requires Python 3.12+.

Building predictive models for cyber-physical systems, the kind of hybrid hardware-software stacks that run power grids, autonomous vehicles, and factory floors, has long been a boutique craft. Every new sensor rig or robot fleet tends to spawn its own bespoke training pipeline, its own data loaders, and its own evaluation harness. A team from Hamburg University of Technology, Fraunhofer CML, and OFFIS wants to end that duplication with Flowcean, a modular Python framework that treats CPS model generation as a composable pipeline problem.

Why CPS modeling breaks the usual ML stack

Existing machine learning frameworks are powerful, but they are typically designed for specific learning strategies, such as passive learning on static datasets or reinforcement learning in controlled environments, which limits their flexibility in accommodating different approaches or generalizing across various CPS applications. The authors point out a painful practical consequence: adapting the same system for different learning strategies typically requires modifying the learning library and restructuring the data pipelines. A framework optimized for passive learning may not efficiently handle incremental learning scenarios, where models must be continuously updated as new data become available, and deep learning frameworks may not support automata-based approaches or decision trees, which are better suited for certain types of CPS.

That mismatch matters because CPS problems rarely fit neatly into one paradigm. A wind turbine model might need automata learning for its discrete control logic, a neural network for its aerodynamics, and streaming updates as sensors drift over time. Due to the complexity of CPS behavior, it is often difficult to predict the optimal approach and framework before modeling begins, leading to duplicated effort if a change in framework becomes necessary mid-process.

The pipeline as a set of Lego bricks

Flowcean decomposes data-driven modeling into six roles arranged in a learning stage and an evaluation stage: environment, transforms, learner, model, evaluation environment, and metrics. The interesting design decision is the environment abstraction, which unifies how data enters the pipeline regardless of source:

  • Offline Environment: loads a precollected dataset from a file or database as a single batch.
  • Incremental Environment: provides a continuous stream of observations, either live sensor data or a batchwise replay of stored data.
  • Active Environment: exposes an interactive interface where the learner requests actions and the system responds, matching reinforcement-learning-style loops.

To the authors' knowledge, Flowcean is the first framework to inherently combine these three variants of learning strategies under one interface, which is the real contribution beyond the marketing pitch. Because each environment type only serves compatible learners, swapping from a static CSV workflow to a live gRPC connection with a real robot does not require rewriting the training loop.

What ships in the box

The current implementation focuses on breadth over depth, wiring together well-known libraries rather than reinventing them:

ModuleImplementations
EnvironmentLoaders for CSV, JSON, Parquet, YAML, ROS bag; interfaces to Polars and PyTorch datasets; ODE simulator
TransformExplode, Select, Sliding window, Standardize
LearnerPyTorch Lightning, scikit-learn linear regression, regression tree, external gRPC learners
MetricMAE, MSE, max error, R2 for regression; accuracy, precision, recall, F-beta for classification

The gRPC hook is the escape hatch for the polyglot reality of CPS tooling. Automata-learning libraries like LearnLib live in the Java world, so Flowcean calls them over RPC instead of forcing a Python port.

A water tank, two learners, one line changed

The case study is deliberately toy-sized: a non-linear water tank governed by an ODE, sampled at 0.1 seconds for 250 steps. A sliding-window transform reshapes the trace so the model predicts the next fill level from the current inflow plus two lagged samples. An 80/20 split feeds two different learners: a scikit-learn regression tree and a PyTorch Lightning multi-layer perceptron.

The numbers are less interesting than the ergonomics. The regression tree hit a mean absolute error of 0.0206 in 15.5 ms of training; the MLP landed at 0.0639 MAE after 813 ms. But the headline for practitioners is that the entire pipeline fits in under a hundred lines of Python, and swapping learners is a one-liner:

tree_learner = RegressionTree(max_depth=5)
neural_learner = LightningLearner(max_epochs=100)

Where it fits, and where it doesn't

Flowcean is aimed at teams doing repeated modeling work across heterogeneous CPS: smart grids, autonomous vehicles, or industrial automation where you want a unified framework to manage every aspect of CPS modeling under one roof. The roadmap points toward energy networks, port technologies, and logistics robots as target domains, with monitoring agents and test-case generators as the next application concepts.

It is not a competitor to PyTorch or scikit-learn, and it doesn't ship novel algorithms. The value is in the interfaces: if you frequently prototype models against simulations, then need to retarget them at streaming sensor feeds or live hardware, the environment abstraction removes a lot of glue code. If you are training a single model on a single static dataset, plain scikit-learn will feel less ceremonious.

Getting the code

Flowcean is publicly available under the BSD 3-Clause license on GitHub, with a Python package on PyPI requiring Python 3.12 or newer. Optional extras include palaestrai, pysr, river, torch, and xgboost, so you can pull in only the learners you actually need.