ThingML+: Augmenting Model-Driven Software Engineering for the Internet of Things with Machine Learning

Armin Moin, Stephan Rössler, Stephan Günnemann

Abstract

The increasing complexity of Internet of Things (IoT) and Cyber-Physical Systems (CPS) challenges traditional Model-Driven Engineering (MDE) approaches. ThingML+ proposes a framework to bridge the gap between MDE and Machine Learning (ML) by extending the ThingML modeling language. This allows developers to specify system behaviors through data-driven inference rather than relying solely on rigid, manually defined state machines. This paper outlines the conceptual framework, technical components, and research roadmap for integrating ML as a first-class citizen in the IoT software development lifecycle.

Introduction

In the development of IoT and CPS, MDE is a standard practice for managing complexity through high-level blueprints that generate executable code. Traditionally, these models rely on state machines to define system behavior using explicit logic. For example, a climate control system might transition between states based on fixed temperature thresholds.

Traditional state machine logic for an IoT device, illustrating the rigid transitions that ThingML+ aims to augment with ML inference.

However, as IoT systems interact with increasingly unpredictable physical environments, these behaviors become too complex to hard-code manually. There is a growing need for systems that can "learn" their behavior from data. Currently, a significant gap exists between the tools used by software engineers for system architecture and those used by data scientists for ML model development. ThingML+ seeks to unify these two worlds.

Methodology: The ML-Quadrat Framework

The paper introduces the ML-Quadrat research project, which extends the existing open-source ThingML tool to incorporate ML concepts directly into the modeling process.

Language Extension

The syntax and semantics of the ThingML Domain-Specific Modeling Language (DSML) are being modified to treat ML concepts as first-class citizens. This allows for a holistic integration where ML is part of the entire software lifecycle, from design-time modeling to run-time execution.

Inference-Based Behavior

A core innovation is the "Inference View." Instead of defining a component's behavior solely through a state machine, developers can delegate specific behaviors to an ML algorithm. This algorithm performs inference based on observed data streams, allowing for more adaptive and nuanced system responses than traditional logic.

Advanced Code Generation

To support real-world deployment, the project targets automatic code generation for specialized stream processing and Complex Event Processing (CEP) platforms. Initial targets include Apache SAMOA for distributed streaming ML and Apama for real-time analytics.

Discussion and Key Insights

The integration of ML into MDE requires bridging the polysemy of the term "model." In software engineering, a model is a structural blueprint (like a UML diagram); in machine learning, it is a statistical artifact (like a Neural Network). ThingML+ links these definitions within a single workflow.

Furthermore, this approach aims to democratize data science. By providing "hints and advice" during the modeling phase, the tool can guide software engineers—who may not be expert data scientists—in deploying smart services. This moves beyond treating ML as a "black box" API call, instead integrating it into the system's architectural logic and deployment scripts.

Limitations and Future Directions

Transitioning from pure SE tools to hybrid SE/ML tools presents several challenges:

  • Code Generation Complexity: Generating code from inference models is fundamentally different from state machine translation.
  • Data Preparation: Automating data cleansing and feature engineering within a modeling tool is a significant undertaking.
  • Hyperparameter Tuning: The sensitivity of algorithms like Neural Networks to hyperparameters suggests a need for integrating AutoML (Automated Machine Learning) to handle tuning automatically.
  • Formal Specification: The lack of formal ways to specify ML best practices in modeling languages remains a barrier to full automation.

Conclusion

ThingML+ represents a significant step toward evolving MDE for the data-driven era of IoT. By treating ML inference as a complementary view to traditional state machines, the framework provides a path for building more robust, adaptive, and intelligent cyber-physical systems.

Summary updated

Abstract

In this paper, we present the current position of the research project ML-Quadrat, which aims to extend the methodology, modeling language and tool support of ThingML - an open source modeling tool for IoT/CPS - to address Machine Learning needs for the IoT applications. Currently, ThingML offers a modeling language and tool support for modeling the components of the system, their communication interfaces as well as their behaviors. The latter is done through state machines. However, we argue that in many cases IoT/CPS services involve system components and physical processes, whose behaviors are not well understood in order to be modeled using state machines. Hence, quite often a data-driven approach that enables inference based on the observed data, e.g., using Machine Learning is preferred. To this aim, ML-Quadrat integrates the necessary Machine Learning concepts into ThingML both on the modeling level (syntax and semantics of the modeling language) and on the code generators level. We plan to support two target platforms for code generation regarding Stream Processing and Complex Event Processing, namely Apache SAMOA and Apama.
BibTeX
@inproceedings{moin2018thingml,
  author = {Armin Moin and Stephan Rössler and Stephan Günnemann},
  title = {{ThingML+: Augmenting Model-Driven Software Engineering for the Internet of Things with Machine Learning}},
  booktitle = {MoDELS (Workshops)},
  year = {2018},
  url = {https://openreview.net/forum?id=iQuBpFgxIH},
}
Figure