cMoflon: Model-Driven Generation of Embedded C Code for Wireless Sensor Networks

  • Roland KlugeEmail author
  • Michael Stein
  • David Giessing
  • Andy Schürr
  • Max Mühlhäuser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10376)


Wireless sensor networks (WSNs) are an indispensable part of the emerging Internet of Things. The topology of a WSN is a graph representing the sensor nodes and their interconnecting links. To reduce the energy consumption of a WSN, a topology control algorithm inactivates inessential links, and the sensor nodes reduce their transmission power while preserving crucial integrity properties (e.g., connectivity). In previous work, we have shown that model-driven engineering allows to prototype topology control algorithms that (i) preserve the specified integrity properties and (ii) can be rapidly evaluated in a network simulator. In this paper, we complement our approach by proposing cMoflon, an open-source tool that generates embedded C code for hardware sensor testbeds. The target platform is the Contiki WSN operating system. To show the applicability of cMoflon, we generate code for three representative topology control algorithms: kTC, l*-kTC, and LMST. A comparison of the generated topology control algorithms with their manually tuned counterparts for TelosB sensor nodes shows that cMoflon generates embedded code that is competitive w.r.t. code memory usage.


Code generation Wireless sensor networks Model-driven engineering 



This work has been funded by the German Research Foundation (DFG) as part of project A1 within the Collaborative Research Center (CRC) 1053 – MAKI.


  1. 1.
    Al Saad, M., Fehr, E., Kamenzky, N., Schiller, J.: ScatterClipse: a model-driven tool-chain for developing, testing, and prototyping wireless sensor networks. In: Proceedings of the International Symposium on Parallel and Distributed Processing with Applications (ISPA), pp. 871–885 (2008).
  2. 2.
    Bak, C., Plump, D.: Compiling graph programs to C. In: Echahed, R., Minas, M. (eds.) ICGT 2016. LNCS, vol. 9761, pp. 102–117. Springer, Cham (2016). doi: 10.1007/978-3-319-40530-8_7 CrossRefGoogle Scholar
  3. 3.
    Berardinelli, L., Di Marco, A., Pace, S., Pomante, L., Tiberti, W.: Energy consumption analysis and design of energy-aware WSN agents in fUML. In: Taentzer, G., Bordeleau, F. (eds.) ECMFA 2015. LNCS, vol. 9153, pp. 1–17. Springer, Cham (2015). doi: 10.1007/978-3-319-21151-0_1 CrossRefGoogle Scholar
  4. 4.
    Dunkels, A., Gronvall, B., Voigt, T.: Contiki - a lightweight and flexible operating system for tiny networked sensors. In: Proceedings of the International Conference on Local Computer Networks (LCN), pp. 455–462 (2004).
  5. 5.
    Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamentals of Algebraic Graph Transformation. Springer, Heidelberg (2006).
  6. 6.
    Essaadi, F., Ben Maissa, Y., Dahchour, M.: MDE-based languages for wireless sensor networks modeling: a systematic mapping study. In: El-Azouzi, R., Menasché, D.S., Sabir, E., Pellegrini, F.D., Benjillali, M. (eds.) Advances in Ubiquitous Networking 2. LNEE, vol. 397, pp. 331–346. Springer, Singapore (2017). doi: 10.1007/978-981-10-1627-1_26 CrossRefGoogle Scholar
  7. 7.
    Fischer, T., Niere, J., Torunski, L., Zündorf, A.: Story diagrams: a new graph rewrite language based on the unified modeling language and java. In: Ehrig, H., Engels, G., Kreowski, H.-J., Rozenberg, G. (eds.) TAGT 1998. LNCS, vol. 1764, pp. 296–309. Springer, Heidelberg (2000). doi: 10.1007/978-3-540-46464-8_21 CrossRefGoogle Scholar
  8. 8.
    Geiß, R., Batz, G.V., Grund, D., Hack, S., Szalkowski, A.: GrGen: a fast SPO-based graph rewriting tool. In: Corradini, A., Ehrig, H., Montanari, U., Ribeiro, L., Rozenberg, G. (eds.) ICGT 2006. LNCS, vol. 4178, pp. 383–397. Springer, Heidelberg (2006). doi: 10.1007/11841883_27 CrossRefGoogle Scholar
  9. 9.
    Heckel, R., Wagner, A.: Ensuring consistency of conditional graph rewriting - a constructive approach. In: Proceedings of the Joint COMPUGRAPH/SEMAGRAPH Workshop. ENTCS, vol. 2, pp. 118–126. Elsevier (1995).
  10. 10.
    Kluge, R., Stein, M., Varró, G., Schürr, A., Hollick, M., Mühlhäuser, M.: A systematic approach to constructing incremental topology control algorithms using graph transformation. J. Vis. Lang. Comput. (JVLC) 38, 47–83 (2016). CrossRefGoogle Scholar
  11. 11.
    Kluge, R., Stein, M., Varró, G., Schürr, A., Hollick, M., Mühlhäuser, M.: A systematic approach to constructing families of incremental topology control algorithms using graph transformation. J. Softw. Syst. Model. (SoSyM), 1–41 (2017).
  12. 12.
    Kluge, R., Varró, G., Schürr, A.: A methodology for designing dynamic topology control algorithms via graph transformation. In: Kolovos, D., Wimmer, M. (eds.) ICMT 2015. LNCS, vol. 9152, pp. 199–213. Springer, Cham (2015). doi: 10.1007/978-3-319-21155-8_15 CrossRefGoogle Scholar
  13. 13.
    Leblebici, E., Anjorin, A., Schürr, A.: Developing eMoflon with eMoflon. In: Ruscio, D., Varró, D. (eds.) ICMT 2014. LNCS, vol. 8568, pp. 138–145. Springer, Cham (2014). doi: 10.1007/978-3-319-08789-4_10 Google Scholar
  14. 14.
    Li, N., Hou, J.C., Sha, L.: Design and analysis of an MST-based topology control algorithm. IEEE Trans. Wirel. Commun. 4(3), 1195–1206 (2005)CrossRefGoogle Scholar
  15. 15.
    Lim, R., Ferrari, F., Zimmerling, M., Walser, C., Sommer, P., Beutel, J.: FlockLab: a testbed for distributed, synchronized tracing and profiling of wireless embedded systems. In: Proceedings of the ACM/IEEE Conference on Information Processing in Sensor Networks (IPSN), pp. 153–165 (2013).
  16. 16.
    Polastre, J., Szewczyk, R., Culler, D.: Telos: enabling ultra-low power wireless research. In: International Symposium on Information Processing in Sensor Networks (IPSN), pp. 364–369 (2005).
  17. 17.
    Portocarrero, J.M.T., Delicato, F.C., Pires, P.F., Rodrigues, T.C., Batista, T.V.: SAMSON: Self-adaptive Middleware for Wireless Sensor Networks. In: Proceedings of the ACM Symposium on Applied Computing (SAC), pp. 1315–1322. ACM, New York (2016).
  18. 18.
    Richerzhagen, B., Stingl, D., Rückert, J., Steinmetz, R.: Simonstrator: simulation and prototyping platform for distributed mobile applications. In: Proceedings of the International Conference on Simulation Tools and Techniques (SIMUTools), pp. 99–108. ICST (2015).
  19. 19.
    Rozenberg, G. (ed.): Handbook of Graph Grammars and Computing by Graph Transformation. Foundations, vol. 1. World Scientific (1997).
  20. 20.
    Santi, P.: Topology Control in Wireless Ad Hoc and Sensor Networks, 1st edn. Wiley, Chichester (2005)CrossRefGoogle Scholar
  21. 21.
    Santi, P.: Topology control in wireless ad hoc and sensor networks. ACM Comput. Surv. (CSUR) 37(2), 164–194 (2005). MathSciNetCrossRefGoogle Scholar
  22. 22.
    Schweizer, I., Wagner, M., Bradler, D., Mühlhäuser, M., Strufe, T.: kTC - robust and adaptive wireless ad-hoc topology control. In: Proceedings of the International Conference on Computer Communications and Networks (ICCCN), pp. 1–9 (2012).
  23. 23.
    Stein, M., Petry, T., Schweizer, I., Bachmann, M., Mühlhäuser, M.: Topology control in wireless sensor networks: what blocks the breakthrough? In: Proceedings of the International Conference on Local Computer Networks (LCN), pp. 389–397 (2016).
  24. 24.
    Steinberg, D., Budinsky, F., Merks, E., Paternostro, M.: EMF: Eclipse Modeling Framework. Addison Wesley Professional, Boston (2008). Google Scholar
  25. 25.
    Varró, G., Anjorin, A., Schürr, A.: Unification of compiled and interpreter-based pattern matching techniques. In: Vallecillo, A., Tolvanen, J.P., Kindler, E., Störrle, H., Kolovos, D. (eds.) ECMFA 2012. LNCS, vol. 7349, pp. 368–383. Springer, Heidelberg (2012). doi: 10.1007/978-3-642-31491-9_28 CrossRefGoogle Scholar
  26. 26.
    Völter, M., Stahl, T., Bettin, J., Haase, A., Helsen, S.: Model-Driven Software Development: Technology, Engineering, Management. John Wiley & Sons (2013)Google Scholar
  27. 27.
    Wang, Y.: Topology control for wireless sensor networks. In: Li, Y., Thai, M.T., Wu, W. (eds.) Wireless Sensor Networks and Applications. Signals and Communication Technology, pp. 113–147. Springer, US (2008). doi: 10.1007/978-0-387-49592-7_5 CrossRefGoogle Scholar
  28. 28.
    Whitmore, A., Agarwal, A., Da Xu, L.: The internet of things-a survey of topics and trends. Inf. Syst. Front. 17(2), 261–274 (2015). CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.Real-Time Systems LabTU DarmstadtDarmstadtGermany
  2. 2.Telecooperation GroupTU DarmstadtDarmstadtGermany

Personalised recommendations