Ball in Tube (balltube)

A fan at the bottom of a tube produces an air stream moving upwards. A ball levitates in the air stream.

The task is to control the ball’s position z. Actuating variable is the motor’s control signal u_{pwm}.

Image of Ball in Tube System

Fig. 10 The ball in tube system

The example comes with two models, which differ in the reaction to the ball falling down. The BallInTubeModel makes the ball stick to the ground once it falls down. The BallInTubeSpringModel lets the ball to jump back up again:

The OpenLoop controller ignores the current state and output of the model, as well as trajectory values. Instead it gives the opportunity to set the actuating variable u_{pwm} manually.

The ball’s position is used as a flat output in this flatness based feedforward module:

A 3D visualizer is implemented. In case of missing VTK, a 2D visualization can be used instead.

An external settings file contains all parameters. All implemented classes import their initial values from here.

Regimes are stored in two files. At program start, the main function loads six regimes from the file default.sreg. In addition, nine regimes can be loaded manually from the file experiments.sreg.

The structure of __main__.py allows starting the example without navigating to the directory and using an __init__.py file to outsource the import commands for additional files.

The example also provides a package for symbolic calculation.