IFAC PapersOnLine 52-9 (2019) 242–247
Remote Control of Towercopter
Faculty of Electrical Engineering and Information Technology
Slovak University of Technology
Abstract: The paper presents remote control of a new laboratory experiment that was built at the
department. It consists of one propeller that is able to move in vertical direction. The task is to control the
position of the propeller. For this purpose, the PID controller was used. Since the experiment was
realized remotely it was necessary to solve both the server and the client side. The client part was formed
by the environment of the presented online laboratory manager. The server part was supported both by
commercial (Matlab) and free (Scilab) simulation environment, as well. The user can choose which one
he or she prefers to use.
©
Keywords Remote control, control education, online experiments, software tools.
1. INTRODUCTION 2. PLANT DESCRIPTION
The number of interactive Internet applications is The towercopter is based on Arduino UNO R3
permanently growing. The positive fact is that these microcontroller ( . The communication with the
applications are not connected just with everyday life plant is realized via USB port that has parameters of the serial
activities such as online shopping, buying of various types of port. The plant accepts control commands and sends back the
tickets (for flights, trains, busses, cultural events), message with measured values. Both commands and the
accommodation booking, trips planning, game playing, but message have the same format. It is a string consisting of 4
also with research and education. The online and remote parts separated by commas.
experiments can supplement and enrich the classical teaching
methods (Restivo and Cardoso, 2013), (Urbano et al.,
2017), (Ligušová et al., 2013).
Remote experiments can help with teaching medicine,
programming, all kinds of engineering areas including
control education. Some examples can be found e.g. in
(Heradio et al., 2016), (Orduña, 2011), (De La Torre et al.,
2015), (Ozvoldova et al., 2014), (Saenz et al., 2015),
(
The advantage of remote experimentation except of time
availability consists in the fact that running such experiment
is quite comfortable for an user. All experiment set up is
completely prearranged, it is safe both for user and the device
as well. Very often it is only sufficient to set the parameters,
start the experiment by clicking the start button and then just
wait for the measured data. Running such experiment
reminds computer simulation, but in fact the user gets real
data from a real measurement that can be later processed
according to educational aims.
Another pleasant effect is that remote experiment can be run
from quiet office or home space. The presented plant of
towercopter illustrated in Fig.1 is quite noisy and making
experimentation with it for couple of hours can be not very Fig. 1. Towercopter plant.
comfortable. So, the remote realization also brings
improvement of working place. Using control command, it is necessary to define several
operations that allows
©
Peter Sabol et al. / IFAC PapersOnLine 52-9 (2019) 242–247 243
to accomplish the plant initialization, uselessly complicated. The remaining two blocks enables to
exchange both binary and ascii data, as well. In this case,
to start experiment, setting of parameters is a little bit problematic because it is
realised via modal windows. In addition, for selected serial
to do its restart, interface just COM ports typical for Windows OS are
to end the experiment, available. For Linux OS an alternative (not so
straightforward) solution has to be used.
to force the plant power off,
The third possibility is to use Level-2 Matlab S-function. It
to change the sampling period (respecting the plant consists in programming own functionality for the block that
limitation 5 different values are allowed – 20ms, will communicate with serial interface. It can be written in
40ms, 60ms, 80ms and 100ms) and Matlab, C, C++ or Fortran language. The easiest way is to
modify an example S-function supplied by Mathworks. Since
to send the control signal value. the implementation for Linux OS was without any obstacles
we decided to choose this way of realisation.
The message with measured values contains actual values of
motor performance and position values from infrared and The created S-function enables writing commands to the
ultrasound sensor. In addition, we also receive an information plant and reading measured data from the experiment. The
about the number of sampling periods from the last control processed output data are stored to the log file. The function
command. has
3 input parameters: sampling period, path to the
serial port of the external device and path to the
output log file.
3 obligatory methods – ,
and .
The method initializes the function and sets their
parameters such as number of inputs and outputs, number of
dialog parameters, sampling period, etc. In addition, the
method also registers callback methods that are executed
during simulation running.
The second compulsory method computes and
sets block outputs. Finally, the method
stops the communication and deletes useless data from
Fig. 2. Propeller detail. memory.
The aim is to enable remote control of towercopter via There are also defined three other methods. Method
Matlab or Scilab environment on Linux based operating serves for checking input
system. parameters.
Method initializes communication with the plant
3. COMMUNICATION WITH PLANT via serial port. The part of such initialization is shown in
In remote experimentation we supported 2 simulation tools – Fig.3.
commercial Matlab/Simulink and free Scilab/Xcos. In using
both environments we had to respect some specificities.
3.1 Matlab
There are at least 3 basic ways how to communicate in
Simulink environment with plant.
The first possibility is to use Simulink Desktop Real-Time or
Simulink Desktop Real-Time Add-On products. However,
they both are not available for Linux operating system.
The second possibility is represented by the Instrument
Control Toolbox. This toolbox has five blocks for
communication with real devices via serial port. Three of Fig. 3. Part of the code for initialization of communication
them enable to send and accept binary data. In our case it is via serial port.
244 Peter Sabol et al. / IFAC PapersOnLine 52-9 (2019) 242–247
The method is executed only one time – at the beginning of whose functionality is evident from the name of the
the simulation. Firstly, the method checks the availability of commands. The toolbox can be easily linked to Xcos via
the plant, i.e. if it is really connected to the port. Then, the Function block (scifunc_block_m) that can be found in User-
serial port object is created (via function). After Defined Functions palette. Because this solution appeared to
necessary parameters are established and then data are read in be seamless, simple and efficient, we used it for our
infinite cycle. They are always compared to the value 9020 implementation.
that indicates that the device is ready for work.
4. PLANT CONTROL
One of our requirements was that we wanted to change
parameters of the controller and the required position of The control of towercopter was realised using PID controller
towercopter during the simulation, too. This can be achieved that was complemented by setting initial speed for propeller.
by the standard Matlab function . It corresponds to the value for which the towercopter starts to
move upwards. Thanks to friction, it is not zero. The control
structure implemented in Matlab/Simulink environment is
3.2 Scilab
shown in Fig.4. The scheme in Scilab/Xcos is very similar.
The communication with the plant in Scilab environment can
also be theoretically realised by several ways.
The first solution could be to use Python programing
language. There exist Python module pySerial that enables
communication with the plant. Another library Sciscipy
should enable access to all Scilab functions (according to
library developers). The problem was that using this library
we were not able to import Xcos simulation scheme neither
to make some connection to pySerial module.
Fig. 4. The Matlab/Scilab simulation scheme.
The second possibility consists in the fact that Xcos enables
to use a generic block that behaves according to the user 5. CONTROL OVER INTERNET
defined function. It can be created in C language, Fortran or
even in Scilab. Such function can ensure communication with After solving local control of the plant it is possible to
the device. The solution based on C language can be used proceed to the realisation over Internet.
without problems (we tested it with another plant). However,
it requires a pre-programmed and compiled function to be For this purpose, we use remote lab management system that
defined in the generic block. The compilation is needed for was described e.g. in ( , 2016) or (
each change of the function and it is not always effective. 2017). It enables to manage several experiments and the
The solution based on the function written in Scilab does not presented towercopter can be one of them.
require a compilation. The problem brings missing native
support of communication via serial port in Scilab.
There also exist a third party solution – to use so called WG
Serial Xcos IO Block inside of Xcos scheme (Weichinger,
2016). It enables to communicate with a real device that is
connected to the serial port. Parameters needed to ensure a
correct simulation running are the port name (or path to the
port), the transfer rate as well as the format of the input and
output numeric values. In our case the problem is that the
block enables to send and accept just numerical values. Our
plant requires commands in text format.
The last mentioned possibility consists in the use of third
party Serial Communication Toolbox that enables to Fig. 5. Remote laboratory ecosystem.
communicate with devices via serial port. It supports 5
simple commands In Fig.5 one can see that the whole ecosystem consists of one
central web server and several experiment servers that
openserial()
communicate with experimental devices.
writeserial()
The central web server takes care about
readserial()
scheduling the experiment in predetermined time,
closeserial()
running the experiment in batch mode,
serialstatus()
Peter Sabol et al. / IFAC PapersOnLine 52-9 (2019) 242–247 245
management of simulation environments and control created. It is used for writing output data from the
schemes and experiment. During the experiment, data from this file is
perceived and displayed in the graphical interface.
using supporting online communication tools.
The command is implemented to modify parameters
The experiment server enables to run experiments via during the simulation. The end of the experiment is realised
simulation schemes in various simulation environments. For by sending a command
towercopter Matlab and Scilab are currently available. In
general, however, it is also possible to use OpenModelica or Execution of experiment also depends on the selected
pure Python. simulation environment.
Developers can control the experiment through the created Matlab supports its execution via Matlab Engine API for
API. The API call is used to communicate with the device Python. By using
based on the control commands. The application implicitly function, a new instance of MATLAB is created. It is done
supports four basic commands implemented in Python. for each experiment whereby the instance can be shared
locally by another function called
. Inside of Matlab the
experiment is carried out by two functions:
enables to load the selected simulation
scheme and enables to set the individual
states of a particular simulation, e.g. start, pause, continue,
update and stop.
The same procedure has to be realised for the second
implementation, too. Scilab environment is opened in the
console form using command from Python module
Fig. 6. Access to experiment via API control commands. . After Scilab execution it is necessary to
initialize parameters (including serial port) and to start
The command serves to an experiment initialization, simulation. These steps can be realized by execution of one
e.g. to set up the device with the basic configuration. After batch file called simulation.sce.
successful completion, the device should be ready to start the
experiment. This is usually done by command after WEB APPLICATION
defining the input parameters and executing the selected
programming environment. In the same time a log file is Fig.7 shows the web environment for the remote control of
Fig. 7. Web application for remote control of experiment.
246 Peter Sabol et al. / IFAC PapersOnLine 52-9 (2019) 242–247
towercopter. After selection of simulation engine, user can communicate with external device via serial port. Then, it is
define the desired altitude of propeller, own parameters of necessary to solve how to execute the experiment in the
PID controller, simulation time and sampling period. The selected engine using Python commands.
experiment is executed after clicking on the button “Run
experiment”. During the simulation in the Change section it Comparison of both implemented solutions shows that as for
is possible to modify the required altitude and controller the user interface, there is no difference between Scilab and
parameters. The corresponding results from experiment can Matlab software. However, the difference is noticeable by
be followed using visualised plots. following the execution time of both simulation
environments. It takes much more time for Matlab until it
6. PEDAGOGICAL ASPECTS starts. This is due to the complexity of the Matlab
environment. For this reason, it is advisable to ensure that the
Till this moment we described just technical aspects of the Matlab does not start again and again at each experiment but
application. However, it is also important how it can be used that it runs in the background permanently.
in education.
The current solution demonstrates the use of one controller
The application was developed to be used in control courses. design. Users can share the most used structure of the
Students can run the experiment both in open and closed controller – i.e. PID controller. From pedagogical point of
loop. Open loop enables to measure step responses that can view, it would be useful to let students to set up also other
be used for identification of the system. After having the control structures that come out e.g. from LQG design,
identified mathematical model students can start with design adaptive control, optimal control, etc.
of the controllers and understanding the feedback concept.
ACKNOWLEDGMENT
In this moment students can use just predefined PID
controller. We chose this type of controller because it The work presented in this paper has been supported by the
represents the basic control structure that is typically taught Slovak Grant Agency, Grant KEGA No. 025STU-4/2017 and
in the first control courses. Moreover, this controller is used VEGA 1/0745/19.
in most automatic process control applications in industry
today. It is common knowledge that over 90% of industrial The authors thank M. Rábek and M.
loops are closed with PID controllers, as these are readily with system implementation.
available commercially.
Very often students start to control the system just by
guessing the controller parameters. For students it is very REFERENCES
useful when they can see how proportional, integral and
derivative parts of the controller influence the dynamical De La Torre, L., Guinaldo, M., Heradio, R. and Dormido S.
behaviour of the plant. After having the first experience they (2015). The Ball and Beam System: a Case Study of
are ready to try to find controller parameters using some Virtual and Remote Lab Enhancement with Moodle.
tuning rules, too. It enables to verify various analytical tuning IEEE Transactions on Industrial Informatics, vol.PP,
methods that is always very beneficial for students. The no.99, pp.1.
presented experiment enables students to achieve not only
theoretical knowledge but also some practical skills because experiments. Diploma thesis. Slovak Technical
they need to take into account the always presented University in Bratislava, Slovakia. (In Slovak)
unmodelled friction, noise and delays. Heradio, R., de la Torre, L., Galan, D., Cabrerizo, F. J.,
Herrera-Viedma, E. and Dormido, S. (2016). Virtual and
The advantage is that the used platform saves all results from remote labs in education: A bibliometric analysis.
experiments to database. These results can later be exported Computers & Education, vol. 98, pp. 14-38.
to csv files and imported to some other software, e.g. to Ligušová, J., Liguš, J. and Zolotová, I. (2013). Cybernetic
Matlab environment where students can compare the education centre. 24th EAEEIE Annual Conference
achieved results and evaluate the quality of control. (EAEEIE 2013), Chania, pp. 133-138.
Orduña, P., Irurzun, J., Rodriguez-Gil, L., García-Zubia, J.,
Thanks to booking system the experiment is always available Gazzola, F. and López-de-Ipiña, D. (2011). Adding New
just to one user that is fully responsible for its running. Of Features to New and Existing Remote Experiments
course, from security reasons the constraints had to be through their Integration in WebLab-Deusto.
imposed on control signal to avoid the hardware damage. International Journal of Online Engineering (iJOE),
vol.7, no.S2, pp. 33-39.
7. CONCLUSIONS Ozvoldova, M., Spilakova P., and Tkac, L. (2014).
Archimedes' principle-internet accessible remote
Nowadays the presented remote experiment can be realised in
experiment. International Journal of Online
two simulation environments – Matlab and Scilab. However,
Engineering, vol. 10, issue 5, pp. 36-42.
since the system is modular it is possible to include there also
Rábek, M. and K. (2017). Online Laboratory
other engines. Firstly, it would require to solve local
Manager for Remote Experiments in Control, IFAC-
communication with the plant, e.g. to find how to
PapersOnLine, vol. 50, issue 1, pp. 13492-13497.
Peter Sabol et al. / IFAC PapersOnLine 52-9 (2019) 242–247 247
Restivo, M. T. and Cardoso, A. (2013). Exploring Online
Experimentation. International Journal of Online
Engineering (iJOE), vol. 9.
Sabol, P. (2017). Control of Towercopter Internet
Environment. Diploma thesis. Slovak Technical
University in Bratislava, Slovakia. (In Slovak)
Saenz, J., Chacon, J., De La Torre, L., Visioli, A. and
Dormido, S. (2015). Open and Low-Cost Virtual and
Remote Labs on Control Engineering, IEEE Access,
vol.3, pp.805-814.
14th IEEE
International conference on emerging elearning
technologies and applications ICETA. Starý Smokovec,
Slovakia.
Urbano, D., Chouzal F. and Restivo, M. T. (2017).
Usefulness of remote experiments. 4th
Experiment@International Conference (exp.at'17), Faro,
pp. 253-257.
Weichinger, K. (2016). WG Serial Xcos IO Block.
https://atoms.scilab.org/toolboxes/wgserialxcosio
Programming Teaching. 11th IFAC Symposium on
Advances in Control Education, Bratislava, Slovakia.