Python as Technology Enabler for TTTech's Development Software
Category: | Software Devleopment, Business, Government |
---|---|
Keywords: | Embedded Systems, Quality, Configuration, Public Safety, Rapid Application Development, Real Time, Testing, |
Title: | Python as Technology Enabler for TTTech's Development Software |
Author: | Ralf Schlatterbeck |
Date: | 2003/01/17 15:59:02 |
Website: | http://www.tttech.com/ |
Summary: | TTTech uses Python to build Time-Triggered Protocol (TTP) based tools and applications for safety-critical real-time systems. |
Logo: |
Introduction
TTTech, founded in 1998, focuses on developing a technology for safety-critical real-time systems. Our central technology is the Time-Triggered Protocol (TTP), a communication protocol used in embedded systems for distributed fault-tolerant applications, such as drive-by-wire and fly-by-wire vehicles. For TTP, we provide chip models for implementing the necessary hardware in silicon, services to customers using the technology, and a broad range of tools.
When starting out in 1998, we urgently needed tools for configuring TTP-based networks. Several people in the team already had experience in writing configuration tools for embedded systems, mostly in C and C++. Based on those experiences, it was clear that we needed some way to speed up development. One of the requirements was platform independence, our target platforms being all different Windows platforms and optionally Linux. The configuration tools had to be scriptable, in order to interface easily with other tools used by our customers.
These requirements suggested the use of a scripting language able to support a cross-platform GUI toolkit. A prototype of the user interface was built with Python and Tkinter over a weekend. The quick result dispelled top-management doubts, and the project was started with Python.
Implementation
Within three months, an initial team of two people (one person working full-time, one part-time) was able to develop and release the first version of our TTP network configuration tool, TTP-Plan. We had anticipated that parts of the program, notably the scheduler, would have to be recoded as Python extensions in C after the first prototype's completion. In fact, however, TTP-Plan is still coded in pure Python, yet our customers appreciate it for its excellent performance.
Figure A: The TTT-Plan Pilot allows users to manipulate object data and links between objects Zoom in
For the first tool, TTP-Plan, we created a framework in Python that let us apply Python's introspection features in order to reuse, for several different purposes, the information already present in the code.
For example, the help texts present in the tool are reused to produce the reference section in the written documentation. The object model of the configuration tool is visible to the user, displayed in a "Pilot-Window". The Pilot lets the user manipulate object data, and links between objects, by clicking on the respective item (see Figure A). This click opens an object editor for modification of attributes. The object editor is parameterized with the type of object in the model. The code for drawing the object model, for the object editor, and for extracting the help information, is all part of the framework, and can be reused by other tools in the TTP-Tools family. This framework was of great help when building the node configuration tool TTP-Build, which uses a network configuration generated by TTP-Plan to produce the configuration of an individual node in the network.
Productivity of Programmers Using the Framework
Meanwhile, new tools were built using the existing framework. A programmer new to both Python and our framework was able to build a new configuration tool for the LIN protocol, a product that is now called LIN-Plan, within three months. The tool was initially built for a first-time customer and is now generally available. It will soon see its second release.
Tools not Written in Python
The good experiences with the Python-based tools are confirmed by other projects originally coded in C++. The development of TTP-Load, the download tool, started in 1999. We decided to write this tool in C++ because the tool had to use a low-level Ethernet driver in order to communicate with an Ethernet-to-TTP gateway, called a monitoring node. The protocol for communicating with the monitoring node at the time used raw Ethernet frames.
The year 2001 saw two major changes. A new TTP controller was introduced, and we faced a redesign of TTP-Load because the download protocol of the chip had changed, and support of different download targets was difficult. Communication over raw Ethernet to the monitoring node used a hard-to-maintain driver that needed constant adaptation to new Windows versions. Instead of porting the driver to new Windows versions -- at that time Windows NT was supported but we had urgent requests for Windows 2000 and XP was already visible on the horizon -- we decided to use standard internet protocols (UDP for the old monitoring node and TCP for the new one) for communication. For TTP-Load, which does not have performance requirements for the user interface, it was decided to rewrite the tool from scratch, entirely in Python. This was done by one person not familiar with the framework within six weeks.
Conclusion
In our experience, programming productivity is substantially higher with Python than with C++. This is substantiated in detail in a paper presented at OSCON 1999 by one of our developers [1].
Today, five people are involved with the daily development of our Python-coded tools. Relying on our Python framework, we are able to quickly implement new features, and to adapt the tools to newly available hardware on short notice.
To summarize, with Python we were able to produce a mission-critical set of software products -- success of TTP as a communication protocol depends on the availability of high-quality configuration tools -- within a short time frame. The code is very easy to maintain, and recoding in Python a whole medium-sized project proved an easy task too. Overall, using Python has led to a successful product line with an ever-growing number of satisfied customers.
About the Author
Ralf Schlatterbeck Ph.D. specialises in tool support for embedded and real-time systems. He has written a number of development tools for real-time programmers. Ralf joined TTTech in 2000, after the tools described in this story had already been written, and is now responsible for their further development and maintenance.
[1] | Christian Tanzer, "Python as a Deadline Killer", O'Reilly Open Source Software Convention (OSCON), August 1999, Monterey (CA). |