Remote Experimentation with Thermo-Optical Plant via Mobile Application

The paper demonstrates remote control of thermo-optical plant via Android based mobile application. The user can run the experiment in an open or closed loop. The plant control is realized via predefined PID controller whose parameters can be changed. Another possibility is to use own customized controller whereby the control algorithm has to be defined using the syntax of SciLab environment that is running in background of the whole experiment.


INTRODUCTION
According to the survey accomplished by Netcraft in May 2016 there exist 1,033,790,346 web sites over the world [1,2].In spite of the fact that not all web sites are really active, the number is enormous and the World Wide Web is a vast information resource that is available anytime and anywhere.It is sufficient to have a computer connected to the Internet.
The development of phones also recorded significant changes from a landline, via simple mobile phones to today's smartphones with rich features.They can be used as a small handheld computer, even with the possibility of contactless payments.Since smartphones can be used really in multilateral ways, there occurs a growing demand for mobile applications that allow us to perform certain activities without the need for a computer.Applications can remind us a meeting, help us to find required information via our favorite browser, or find a place of our interest.With its computing power it is almost equal to a computer.Since we keep our mobile phones most of the day together with us, they become a tool how to be more effective, whether we are at work or on the move.
Mobile applications can also be used in technical education.Control of remote experiments is nowadays common with a computer and web browser.Thanks to these technologies we are able to manage and monitor the experiment anywhere in the world.In recent years, mobile applications are also pervasive in this area.Using the mobile application (as well as on the web) we can manage devices, controllers, track reports and perform real experiments on remote devices.The results can be observed directly in the application while running experiment.The examples of such use of mobile applications can be found e.g. in [3][4][5][6][7].This paper demonstrates the use of mobile application for the control of thermo-optical plant.In this way it tries to extend the number of applications that deal with online experimentations and can be found e.g. in [8][9][10][11][12][13].

II. THERMO-OPTICAL PLANT
The introduced thermo-optical laboratory plant uDAQ28/LT (Fig. 1) presents a system that enables to control two physical variables -the temperature inside a plastic cylinder and the intensity of a light source.
The plant [14][15][16][17][18] has three inputs -the bulb voltage (the heat & light source), the ventilator voltage (system cooling) and the light diode voltage (the second possible light source).In addition to these 3 input voltages there also exist two parameter inputs for adjusting the sampling period and the time constant of the built in derivative filter.The user can use eight measured outputs: the system temperature measured by a PT100 sensor, the light intensity (both measured directly, or with a preliminary filtration by the filter of the 1st order) and its derivative, the ambient temperature, the current and the rotation speed of the ventilator.The whole plant is supplied by 12V/2A DC external adapter.
The advantage is that the whole system can communicate with a computer via an USB interface.No special card is required.Since the USB port can be usually found on all today's computers including notebooks, introduced equipment can be easily widespread.
The communication with the computer runs via the string exchange based protocol.The data transfer rate is 250 kbit/s.The plant enables to use a sampling period of 40-50 ms whereas considering the dynamics of the presented system 1 second should be sufficient for its quasicontinuous control.Even though the user can measure 8 variables, students usually do not use all of them.They control the temperature inside the plastic cylinder that is influenced by the bulb heating and the ventilator cooling.In spite of the fact that both these variables can be used for control at the same time together, the plant is very often controlled only by the bulb voltage with the ventilator being considered as a disturbance factor.Another possibility is to control the light intensity that can be influenced by the voltage on the bulb and on the light diode.
As it is possible to see the introduced plant offers a big variability of experiments that can be accomplished.In addition to control, students also have to solve tasks that are connected with the plant identification, input-output data manipulation and communication with external computer environment [19].

A. Architecture
The general architecture for remote control of experiment can be illustrated by the Fig. 2. As it is evident, it is typical client-server architecture.The client requests running of real experiment that is connected to the server.After the experiment is executed the measured data are sent back to the client.
In our case the client is represented by the mobile application that was developed for Android OS.The application was realized using Java programming language and Android SDK tools.These technologies enable developing native Android applications that provide fast performance and a high degree of reliability.The application was prepared in Android Studio development environment, specifically designed for OS Android application development.
The application was created for Android OS 4.0 and higher.It cooperates with database where all dynamic data are stored.The developed REST API facilitates approach to the database for mobile application (Fig. 3).
REST interface is usable for simple and uniform access to resources.In our case the data source is presented by the database.All data have their own URI.The REST request is in the form of key-value pair using the data identifier.The response is received in the form of JSON.REST defines four basic methods to access all data.The methods are also known under the CRUD name ("Create", "Retrieve", "Update", "Delete") and they are implemented by using the HTTP protocol.
The server part of the application (which provides us with the data from the database) was developed using PHP Slim framework.Slim is an open source framework for developing micro PHP applications.It contains sophisticated URL router and middleware architecture, making it ideal for fast and efficient developing static pages and APIs [20].Slim framework was used to form the REST API.
The communication of mobile application with the real plant and the access to the data stored in MySQL database is shown in Fig. 4. To run the experiment, a request is sent to the plant server.After its processing it is sent to the plant (in our case it is the thermo-optical plant).During the experiment the application reads the results in successive steps that are gradually visualized in mobile application in the form of a The application is developed in two language mutations -Slovak and English.

B. Functionality
Only registered users can perform experiments.It is because of management of users communicating with the real device.For registration it is possible to use • university information system account (via LDAP server), • google account or • completely new application account can be created.Google login was implemented using an external library -Google Play services.
After logging in, the user can see the latest report of his or her experimentation.He or she can also see the nearest reservations for available plants.If some of them is active and available in the current time, the experiments can be started.The dashboard enables to follow the process of experiment via graphical dependencies and/or via video stream (camera icon in the top right corner of the screensee Fig. 5).
The user profile contains the basic information about the remote lab user.One can change the name, email, password (for local accounts) and the application language.The administrator can also change the user role.The administrator can manage own user profile, but also profiles of other users.
The very important part of the application is the reservation section (Fig. 6).Since measurements are done on a real device, it is necessary to ensure that the device will be used just by one user.The reservation system avoids time conflicts among various users.Firstly the user can choose the day when the experiment should be done.The current day is visualized by red number and the gray background is used for showing days where already booked time slots of other users are.After choosing the concrete day it is possible to see the detailed view with planned reservations and to add there a new time interval for own experiment.The green background signalizes that my previous reservation is active and the particular equipment is ready for my use.

SHORT PAPER REMOTE EXPERIMENTATION WITH THERMO-OPTICAL PLANT VIA MOBILE APPLICATION
The application enables filtration of reservations for selected device or selected user (administrator view).
Experiments can be run in an open loop (for identification purposes) or controlled in a closed loop.Initially, the PID controller is predefined in the system.The user can use it and modify its parameters (P, I, D components) according to his or her own preferences.However, in addition, there exists also a possibility to create and set a completely new control algorithm.The structure of these new controllers is saved to the database and can be used by the user privately or it can be published for the use by other users.
As it was already told, the thermo-optical plant offers the possibility to control two various variables: the temperature inside a plastic cylinder and the intensity of a light source.The user can choose what type of experiment he or she would like to run by the choice of the control and the controlled variable.It is good to realize that the control of the light intensity is a faster process and the control of the temperature has slower dynamics.The reservation time should reflect these circumstances.
Results of all experiments are saved in the database.The created reports can be seen in any later time.One can follow the measured variables, the parameters that were set during the experiment and the controller structure that was used.
The next functionality is connected with the fact that the application was developed not only for control of the introduced thermo-optical plant but in more general way.It can be also used for experimentation with other devices.The list of plants can be modified (new plant can be created, old one deleted, plant settings can be updated -e.g.actual new IP address of the equipment server).Devices are distinguished by the color that is also used for easier identification in the reservation system.
The last component is virtualization.This part is available only for administrator who has access to the virtual machines (it's starting, stopping, editing, tracking, etc.).They are used for testing and project work of students.
The virtualization is realized using VirtualBox environment that is embedded to the developed application via Android API element.It enables to visualize a new web page content in a similar way as <iframe> element in a web application.
The use case diagram in Fig. 7 enables to follow what components are available for the user and for the administrator.

C. Mobile application
Applications running on Android OS must get permission (during the installation process) from the user to use various features of the phone.It is also a notification what mobile phone functions are going to be influenced.Therefore the inseparable part of the application is the file An-droidManifest.xml that contains all basic settings and permissions.
When the developed application is installed on an Android phone the following list of permissions is requested: • Internet access, • information on the status of the Internet connection, • access to the user account that is paired with the phone -it is needed to login via Google, • access to the phone vibrator -if the user does not follow the progress of the experiment he or she is notified about the termination of the experiment.
The application was tested on 5 various mobile phones (LG Optimus L3, Samsung Galaxy S3 Mini, HTC Desire 500, LG G2, Motorola Moto G) and 2 emulated devices (Samsung Galaxy S5, LG Nexus 5).The devices had RAM memory from 512 MB up to 2048 MB, the resolution from 240 x 320 up to 1920 x 1080 pixels and OS Android version from 4.1.2up to 5.0.Our effort was to have stable application that would look in similar manner also in the case of different resolutions.The paper illustrated the developed interface for mobile phones that can be used for remote control of experiments.The application can be considered as dual to the web interface that can be used for the same purpose.Both applications use the same database.Therefore it is possible that the student starts to work e.g. with web application that is more comfortable because of the bigger size of desktop monitors and finishes the job in the train during his or her way home.On the other hand the user can set its reservation via mobile application and the experiments can be realized later using a standard computer.
The application is planned to be used by normal students that very often prefer to work not only in the university laboratories but also outside of the faculty.Of course, the application can also be used by students in external forms of study.

Figure 5 .
Figure 5.Following the experiment in mobile application Figure 6.Reservation system

Figure 7 .
Figure 7. Use diagram for the application