Вы находитесь на странице: 1из 6

Matlab Plots on Android Smartphones Cloud

Implementation
Cristian RECOANU, Valentin NVRPESCU, Anca DEACONU, Aurel CHIRIL, Drago
DEACONU, Gianfranco CHICCO
Abstract
The paper discusses concepts regarding cloud computing and how a simple form of the system can be
implemented to create a piece of software that can handle Matlab plots on an Android powered smartphone.The
main advantages and disadvantages of such an approach are briefly outlined.
Keywords: Matlab, plots, cloud, Android, computing

1. Introduction
This paper presents the basic steps in
developing a client application for the
Android platform using the cloud computing
concepts.
The cloud computing is a fresh concept
in the IT services market (figure 1).

Figure 1. Cloud computing logical diagram [2]

The major software developers in the


industry are all starting to bring new offers to
light in this area, but what are the true
advantages that lie behind marketing
strategies
and how can they be
implemented?
Cloud computing is the delivery service of
computation, software, data access, and
storage resources without requiring cloud
users to know the location and other details
of the computing infrastructure[1].

Cristian RECOANU, Stud., cristirec@yahoo.com; Valentin


NVRPESCU, Prof.dr., valentin.navrapescu@upb.ro;
Anca DEACONU, PhD Stud., anca.s.deaconu@gmail.com;
Aurel CHIRIL, PhD Lecturer, aurel.chirila@upb.ro; Drago
DEACONU, PhD Lecturer =Universitatea POLITEHNICA
din Bucureti, Facultatea de Inginerie Electric,
dragos.deaconu@upb.ro; Gianfranco CHICCO, Prof.dr.,
Politecnico di Torino, Department of Electrical Engineering,
gianfranco.chicco@polito.it

The foundation of any cloud computing


system is the client-server relation, where a
user sends a computation request and after
a short period of time receives a response
from the server.
2. Developing the system
The goal was to create an Android client
application that can receive input from the
user (X and Y coordinates), verify the
integrity of the data (real numbers, same
number of coordinates on both axes), send a
request to a server and receive a response
in the form of a Matlab 2D plot.
After receiving the request from the
Android client, the server creates a client
handler, an entity that will handle the
computing request for the client (sends the
data from the client to the processing block
and returns the response to the client).
For every client that sends a request, the
server creates an individual client handler
(see Figure 2).

Figure 2. System logical diagram

106

ELECTROTEHNICA, ELECTRONICA, AUTOMATICA, XX, Nr. XXX

The programming environment used was


Eclipse Classic [3], as it is recommended by
both Android and Java developers.
The server was coded in Java [4] and the
client was created using the Android SDK
[5].
The processing block was developed
using a special Matlab toolbox called
MatlabBuilderJA [6] that allows deployment
of Matlab code in the form of Java classes.

coordinates in
(see Figure 4).

the

two

text

boxes

3. Testing the system


First of all, the server needs to be up and
running at all times during any testing
method presented. This is done using the
Eclipse environment by choosing Run As >
Java Application.
If the server is behind a router a working
port has to be forwarded, which is done
using the routers configuration system.
The next step is to configure an Android
Virtual Device (AVD). This is a simulation
platform provided by the Android SDK where
developers can test their applications before
installing them on a physical smartphone.
After configuration, the AVD is also
launched from the Eclipse environment by
running the client application as an Android
application. Keep in mind that the AVD may
take a while to start because it has to go
through all the steps of booting a
smartphone (see Figure 3).

Figure 4. Input interface.

The input interface is further used for


providing feedback regarding issues of
correctness of data. The integrity check that
takes place consists of a number of tests,
which determine if the input data is ready to
be sent to the server for processing.
For every specific error, the user is
informed by a popup message at the bottom
of the screen that disappears after a certain
amount of time.
First, the application tests if there is input
in both text boxes. The Send button remains
inactive until both text boxes have input (see
Figure 5).

Figure 3. AVD window

Once the AVD is fully loaded, the


application is installed and ran on the
simulation platform. Eclipse also provides
the developer with an extensive debugger
that is very useful for both the server and the
client application.
The Android client application has two
interfaces. The first one is the input interface,
where the user inputs their chosen X and Y

Figure 5. Input interface (Test 1 error).

ELECTROTEHNICA, ELECTRONICA, AUTOMATICA, XX, Nr. XXX

This prevents the user from wasting


processing power and time with an
incomplete set of inputs. The second test
consists of checking if both text boxes have
real numbers as input (see Figure 6).

107

presses the Send button and consists of


checking if the client can connect to the
server (see Figure 8). There are several
reasons why the client may not connect,
such as no internet connection or the server
being offline.

Figure 6. Input interface (Test 2 error).

The reason behind this is that the Matlab


class in charge with the computation is
designed to receive real number parameters.
In the next test, the application verifies if the
same number of points are assigned to both
axes (same number of coordinates in both
text boxes, see Figure 7), since Matlab
cannot create a 2D plot from different length
vectors.

Figure 8. Input interface (Test 4 error).

After the input data passes the integrity


check, the client attempts to connect to the
server. During this time, a form of pre-loader
is displayed to the user letting them know the
process is undergoing (see Figure 9).

Figure 9. Input interface (pre-loader).

Figure 7. Input interface (Test 3 error).

The final test is done when the user

The client only connects to the server


after the integrity check because only then is
it certain that bandwidth and processing
power are not wasted for an input set filled

108

ELECTROTEHNICA, ELECTRONICA, AUTOMATICA, XX, Nr. XXX

with errors.
The pre-loader animation ends when the
client application receives the response from
the server for the given request, which is in
the form of a byte array representing the 2D
Matlab image. At this moment, the
application switches to the view interface
(see Figure 10).

been implemented after Android 2.2


distribution.
For saving the image plot to the SD card
several aspects must be taken into account
such as verifying that a mounted SD card
exists and catching all errors that may
appear, with the aim of announcing the user
of the procedures success or failure (see
Figure 12).

Figure 10. View interface.

This is where the user can manipulate the


Matlab plot (scroll, zoom in/zoom out and
also save a copy of the image on the SD
card when long pressing on the image; see
Figure 11).

Figure 12. Input interface (Save procedure outcome).

The application provides the option to


switch between interfaces by pressing the
menu button (see Figure 13).

Figure 11. Input interface (Plot save dialogue).

Implementation of zooming in and out


was done using onscreen buttons. This
method is more reliable than pinch-to zoom
because not all smartphones have multitouch screens and multi-touch features have
Figure 13. Switching interfaces.

ELECTROTEHNICA, ELECTRONICA, AUTOMATICA, XX, Nr. XXX

Pressing the button will display a single


option menu, which allows selecting the
opposite interface. This option is only
available after a valid plot was loaded in the
view interface. This provides the ability to
enter another set of inputs or to review the
previously rendered plot.
The current implementation of the
application disconnects the client from the
server after the response has been received,
terminating the client handlers activity. For
another computation, the client will send a
new request to the server thus creating a
new client handler. This strategy presents a
working concept without the need for
creating a queue for clients and managing
sessions, elements that would have a great
impact on the servers hardware capabilities.
As with many man made systems simpler is
often better and more robust.
After thoroughly testing the application on
the simulator, the APK file created at the
time of the first simulation has to be located
and installed on a physical smartphone,
where the whole batch of tests needs to be
run again. The physical testing platform
needs to run the same operating system and
have the same screen resolution as the
simulator. In addition, the smartphone must
be configured to allow installation from
unknown sources. The installation menu
provides information on the privileges
required by the application to work;, in this
case modifying SD card contents and full
Internet access (see Figure 14).

Figure 14. Application installation.

109

4. Acknowledgment
The work has been co-funded by the
Sectoral Operational Programme Human
Resources Development 2007-2013 of the
Romanian Ministry of Labour, Family and
Social Protection through the Financial
Agreement POSDRU/107/1.5/S/76903 and
POSDRU/89/1.5/S/62557. It was also
supported by SP1-JTI-CS-2009-02-GRC-03001 and EDL UPB.
5. Conclusions
The application provides proof of concept
for solving a problem using the cloud
computing
system.
This
prototype
application can be further used as a starting
point for more complex applications in
various domains. For example, future
versions of this application could allow the
user to plot custom polynomial functions by
writing Matlab code in the input section that
would be decoded by the processing block.
The presented application also provides the
possibility to analyse advantages and
disadvantages of the cloud computing
system.
One of the main advantages is reducing
the costs required to buy professional
software. Every institution or company that
runs activities in the engineering or industrial
environment will find the need for
professional software (engineering design
software,
simulation
software,
data
processing software, statistical modelling
software etc.). Most of these programs
require the purchase of licenses that can be
very expensive. In addition, most programs
are required in multiple copies for different
departments. All this eventually leads to high
costs and special budgets. Implementing a
cloud computing system can be an effective
solution to reduce these costs by decreasing
the number of licenses required. For this
application, a single Matlab license was
needed for the server, which could serve
many clients. Similar to this, a company may
implement cloud computing systems that
solve different problems using several
professional software systems. Licensing
would be required only for the server
systems.
Another advantage would be the
reduction of necessary processing
power. As presented in the previous
sections, all the processing in the cloud

110

ELECTROTEHNICA, ELECTRONICA, AUTOMATICA, XX, Nr. XXX

computing system is done by the server.


This means that client systems do not need
impressive processing power but only a
connection to the server and the means to
send computation requests and to receive
and display the response to the user.
Reducing the number of systems with high
processing power also means lower power
consumption.
Systems
running
client
applications can range from smartphones or
tablets to netbooks, laptops or low power
PCs.
This brings us to the third advantage of
cloud computing implementation and that is
the increase in mobility. This refers to the
employees of an institution or company that
has implemented a cloud computing system.
The need for computation does not bind
them to their desks anymore. They can
request computation from their smartphone
or tablet with internet access from anywhere
thus providing on-the-spot problem solving
(for example problems that appear when
providing maintenance care to equipment).
As with any system or concept, cloud
computing also has shortcomings. One of
them is the dependency on internet
access. Any client that needs to send a
computation request to the server needs to
have a connection to it (usually an internet
connection). To diminish the effect of an
internet blackout, companies can implement
local networks that provide connection to the
server internally, however this would affect
the mobility of clients.
Data safety is another concern when
discussing cloud systems. Computation over
the internet poses security questions. It must
be ensured at all times that outgoing and
incoming data are not intercepted or altered
in any way. The presented application uses
custom classes to encode the data being
sent over the internet. These custom classes
would only be implemented in the server and
client. Another safety issue is the ability to
install the application on the SD card. Many
developers choose to implement this option
in their application because low-end
smartphones have a very small internal
memory. Giving the option to install the
application on the SD card may be a
potential security risk because it makes the

application easier to access and modify its


parameters.
A company interested in implementing a
cloud system needs to be aware of the fact
that there already are cloud computing
packages released by major software
developers in the industry. This means that
the only concerns remaining are How well
does the system adapt to my needs? and
Is the price optimal for my company?
2010 was a key year for the growth of the
smartphones market. IDC reported that
smartphones outsold computers for the first
time [7].
One thing is certain with the expansion
of mobile operating systems and mobile
platforms (smartphones, tablets, laptops),
the cloud system will also grow and provide
a new age for remote computing in various
domains, from business and engineering to
the gaming industry.
References
[1] NIST, The NIST Definition of Cloud
Computing
[online].
[2012]
[quote
07.02.2012];
Available
from:
URL:http://csrc.nist. gov/publications/nistpubs
/800-145/SP800-145.pdf
[2] Wikipedia, Cloud computing logical diagram
[online], [2012] [quote 07.02.2012]; Available
from:
URL:http://en.wikipedia.org/wiki/File:
Cloud_computing.svg
[3] Eclipse developing environment resources
[online]. [2012] [quote 07.02.2012]; Available
from: URL:http://www.eclipse.org/resources/
[4] Java SE 6 documentation [online]. [2012]
[quote
07.02.2012];
Available
from:
URL:http://docs.oracle.com/javase/6/docs/ind
ex.html
[5] Android SDK resources [online]. [2012]
[quote
07.02.2012];
Available
from:
URL:http://developer.android.com/resources/i
ndex.html
[6] MatlabBuilderJA toolbox [online]. [2012]
[quote
07.02.2012];
Available
from:
URL:http://www.mathworks.com/products/jav
abuilder/
[7] GSMARENA.com,
IDC
report
says
smartphones outsell computers for the first
time [online] [2012] [quote 07.02.2012];
Available from: URL:http://www.gsmarena.
com/idc_report_says_smartphones_outsell_c
omputers_for_the_first_time-news-2303.php

Вам также может понравиться