You are on page 1of 7

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/285548959

Remote Interoperability Protocol: A bridge


between interactive interfaces and engineering
systems**This work has been funded by...

Article December 2015


DOI: 10.1016/j.ifacol.2015.11.244

CITATIONS READS

0 31

5 authors, including:

J. Chacn Gonzalo Farias


National Distance Education University Pontificia Universidad Catlica de Valparaso
21 PUBLICATIONS 44 CITATIONS 72 PUBLICATIONS 440 CITATIONS

SEE PROFILE SEE PROFILE

Antonio Visioli S. Dormido


Universit degli Studi di Brescia National Distance Education University
245 PUBLICATIONS 2,640 CITATIONS 514 PUBLICATIONS 3,464 CITATIONS

SEE PROFILE SEE PROFILE

All content following this page was uploaded by S. Dormido on 23 January 2016.

The user has requested enhancement of the downloaded file. All in-text references underlined in blue are added to the original document
and are linked to publications on ResearchGate, letting you access and read them immediately.
3rd
3rd IFAC
IFAC Workshop
Workshop onon Internet
Internet Based
Based Control
Control Education
Education
3rd IFAC
November Workshop
4-6, on Internet Based Control Education
3rd IFAC
November
3rd IFAC 4-6, 2015.
Workshop
Workshop
Brescia,
2015.on
Brescia,
on
Italy
Internet Based
Italy
Internet Based Control
Control Education
Education
November
November 4-6,
4-6, 2015.
2015. Brescia,
Brescia, Italy
Italy Available online at www.sciencedirect.com
November 4-6, 2015. Brescia, Italy

ScienceDirect
IFAC-PapersOnLine 48-29 (2015) 247252
Remote
Remote Interoperability
Interoperability Protocol:
Protocol: A
A bridge
bridge
Remote
Remote Interoperability
Interoperability Protocol:
Protocol: A
A bridge
bridge
between
between interactive
interactive interfaces
interfaces and
and
between
between interactive
interactive interfaces

interfaces and
engineering
engineering systems.
systems.  and
engineering
engineering systems.
systems. 

Jesus
Jesus Chacon
Chacon Gonzalo Farias Hector Vargas
Jesus Chacon Gonzalo

Gonzalo Farias
Farias Hector Vargas
Hector Vargas
Jesus Chacon
Antonio
JesusAntonio
Chacon Gonzalo
Visioli
Gonzalo
Visioli
Farias
Sebastian
Farias
Sebastian Hector
Dormido
Hector
Dormido Vargas
Vargas


Antonio Visioli
Antonio Visioli Sebastian Dormido
Sebastian Dormido
Antonio Visioli Sebastian Dormido

Universidad Nacional de Educacion a Distancia,
Universidad
Nacional de Educacion a Distancia,
Universidad
Universidad e-mail: Nacional
Nacional de
de Educacion
Educacion
jchacon@bec.uned.es. a
a Distancia,
Distancia,

Universidad e-mail:
e-mail: Nacional de Educacion
jchacon@bec.uned.es.
jchacon@bec.uned.es. a Distancia,
Pontificia e-mail:
Pontificia Universidad
e-mail:
Universidad jchacon@bec.uned.es.
Catolica
jchacon@bec.uned.es.
Catolica de
de Valparaso,
Valparaso, Chile.
Chile.
Pontificia
Universidad Catolica de Valparaso, Chile.
Pontificia
Dipartimento
Pontificia Universidad
di
Universidad Catolica
Ingegneria
Catolica de
Meccanica
de Valparaso,
e Chile.
Industriale,
Valparaso, Chile.
Dipartimento

Dipartimento di Ingegneria
didegli
Ingegneria Meccanica
Meccanica e Industriale,
e Industriale,
Industriale,
Dipartimento
Universita di Ingegneria
Studi diMeccanica
Brescia, e
Italia.
Dipartimento
Universita
Universita di Ingegneria
degli
degli Studi
Studi di
diMeccanica
Brescia,
Brescia, e Industriale,
Italia.
Italia.
Universita
Universita degli degli Studi
Studi di di Brescia,
Brescia, Italia.
Italia.
Abstract:
Abstract: The
The process
process of
of building
building remote
remote or
or virtual
virtual laboratories
laboratories to
to be
be deployed
deployed via
via Internet
Internet
Abstract:
Abstract:
usually The
The
involves process
process
communicationof
of building
building
between remote
remote or
or
different virtual
virtual
software laboratories
laboratories
tools. Very to
to be
be
often,deployed
deployed
there is avia
via Internet
Internet
separation
Abstract:
usually
usually The
involves
involves process
communication
communicationof building
between
between remote or
different
different virtual
software
software laboratories
tools.
tools. Very
Very to be
often,
often,deployed
there
there is
is a
avia Internet
separation
separation
usually
between
usually
between involves
the
involves
the communication
software which
communication
software which between
interfaces
between
interfaces with
with different
the
different
the model
model software
or
software
or real
realtools.
system,
tools.
system, Very
Very and
and often,
the
often,
the there
software
there
software is
is a
a separation
responsible
separation
responsible
between
between the software
the software which
which interfaces
interfaces with the
with the model
model orrepresentation
or real system,
real system, and thedata
software responsible
of
of
of
providing
between
providing
providing
the
the software
the
the
student
student
student whichwith
with
with
an
an
an
interactive
interfaces with the
interactive
interactive
and
and
and
visual
model
visual
visual real system, and
orrepresentation
representation andof
of
of
the
the
the
the
software
thedata
data
responsible
provided
software
provided
provided
by
responsible
by
by
the
the
the
of
of providing
engineering
providing
engineering the
the student
system.
student
system. with
Abstracting
with
Abstracting an
an interactive
the way
interactive
the way and
these
and
these visual
two
visual
two representation
elements communicate
representation
elements communicate of
of the
the data
with
data
with provided
each
provided
each other
other by
by the
from
the
from
engineering
engineering
the particular system.
system. Abstracting
Abstracting
implementation, the
the
the way
way
requirementsthese
these two
two
are elements
elements
frequently communicate
communicate
the same: with
with
connection each
each other
other
and from
from
session
engineering
the
the particular system. Abstracting
implementation, the
the way
requirementsthese two
are elements
frequently communicate
the same: with
connection each other
and from
session
the particular
the particular
control, data
particular
control, data
implementation,
implementation,
transmission
implementation,
transmission
the
the requirements
control,
the
control, requirements
user
user interaction
requirements
interaction
are
are
frequently
arehandling,
frequentlyetc.
frequently
handling,
the
the
etc.
same:
theThis
same:
same:
This
connection
connection
work describes
connection
work describes
and
and
and
session
session
aa generic
session
control,
control,
protocol data
data
to transmission
transmission
interoperate control,
control,
remotely user kind
user
any interaction
interaction
of handling,
handling,
engineering etc.
etc.
software. This
This work
work
The describes
describes
solution a generic
a
proposes generic
genericto
control,
protocol
protocol data
to
to transmission
interoperate
interoperate control,
remotely
remotely user
any
any interaction
kind
kind of
of handling,
engineering
engineering etc.
software.
software. This work
The
The describes
solution
solution a
proposes
proposes genericto
to
protocol
encapsulate
protocol
encapsulate to
to interoperate
all the
interoperate
all the remotely
communication
remotely
communication any
issues
any
issues kind
kindinto
into of
ofan
anengineering
interoperability
engineering
interoperability software.
software.API
API The
that
The
that solution
can be
solution
can be proposes
implemented
proposes
implemented to
to
encapsulate
encapsulate all
all thesystems.
communication issues into an interoperability API that can be implemented
in
in
in
many
encapsulate
many
many all the
different
different
different
communication
thesystems.
systems.
In
communication
In
In
order
order
order
issues
to
issues
to
to
show
show
show
into
intothean
an interoperability
the
the
flexibility
interoperability
flexibility
flexibility
of
of
of
such
such
such
API
APIAPI,
API,
API,
that
thatan
an
an
can
can be
be implemented
implementation
implemented
implementation
implementation
to
to
to
in
in many
interoperate
many
interoperatedifferent
MATLAB
different
MATLAB systems.
systems.from
from In
In order
Java
order
Java user
user to
to show
show the
interfaces
the
interfaces flexibility
via JSONRPC
flexibility
via JSONRPC of
of such
suchis
is API,
explained
API,
explained an
an implementation
in detail.
implementation
in detail. to
to
interoperate MATLAB
interoperate MATLAB from from JavaJava user
user interfaces
interfaces via via JSONRPC
JSONRPC is is explained
explained in in detail.
detail.
interoperate MATLAB from Java user interfaces via JSONRPC is
2015, IFAC (International Federation of Automatic Control) Hosting by Elsevier Ltd. All rights reserved. explained in detail.
Keywords:
Keywords: control education, interactive, teaching, computer interfaces, communication
Keywords: control
Keywords:
protocols control education,
control education, interactive,
education, interactive, teaching,
interactive, teaching, computer
teaching, computer interfaces,
computer interfaces, communication
interfaces, communication
communication
Keywords:
protocols
protocols control education, interactive, teaching, computer interfaces, communication
protocols
protocols
1.
1. INTRODUCTION
INTRODUCTION all
all the
the opportunities
opportunities that
that these
these technologies
technologies offer,
offer, three
three
1. INTRODUCTION
1. INTRODUCTION all
all
of the
the
them opportunities
opportunities
present featuresthat
that these
these
of technologies
technologies
special interest offer,
offer,
to three
three
teaching
1. INTRODUCTION all
of
of the
them
them opportunities
present
present features
featuresthat these
of
of technologies
special
special interest
interest offer,
to
to three
teaching
teaching
Networks such
Networks such asas the
the Internet
Internet are are widely
widely distributed
distributed in in of of them
engineering:
them
engineering: present
network
present
networkfeatures
features of
of special
communications,
special
communications, interest
interest to
visualization,
to
visualization,teaching
and
teaching
and
Networksconnecting
Networks
society, such as
such as the
the Internet
Internet
people across areof widely
are widely
the distributed
distributed
world. The in engineering:
in
con- engineering:
interactivity. network
network communications,
communications, visualization,
visualization, and
and
Networks
society, such
connectingas the Internet
people across areof widely
the distributed
world. The in
con- engineering:
interactivity.
interactivity. network communications, visualization, and
society,
society,
nectivity connecting
connecting
between people
people
many across
across
different of
of the
the world.
world.
computational The
The
devices con-
con-is interactivity.
society,
nectivity connecting
between people
many across
different of the world.
computational The
devices con-is interactivity.
Visualization and interactivity have proved to be crucial
nectivity between
nectivity
increasing between
every many
many
year different
different
and, nowadays,computational
computational
the scientificdevices
devicescom- is Visualization and interactivity have proved to be crucial
is
nectivity
increasing between
every many
year different
and, nowadays,computational
the scientificdevicescom- is Visualization
Visualization and
and interactivity
interactivity have
have proved
proved to
to be crucial
increasing
increasing
munity every
every
andevery year
year
engineering and,
and, nowadays,
nowadays,
companies the
the
invest scientific
scientific
economical com-
com-
aspects
and Visualization
aspects
aspects
when
when
when
designing
and
designing
virtual
interactivity
designing virtual
virtual
labs,
have
labs,
labs,
i.e.
proved
i.e.
i.e. to bebe crucial
simulations
simulations
simulations
that
crucial
that
that
increasing
munity
munity and and
and year
engineering
engineering and, nowadays,
companies
companies invest the
invest
invest scientific
economical
economical and com-
and aspects
are
and aspects to when
be used designing
for virtual
pedagogical labs,
purposes,i.e. simulations
in the that
field of
munity
research engineering
effort in the companies
development of economical
technologies are
are to
to when
be
be used
used designing
for
for virtual
pedagogical
pedagogical labs,
purposes,
purposes,i.e. simulations
in
in the
the that
field
field of
of
munity
research
research and engineering
effort
effort in
in the
the companies
development
development invest
of
of economical
technologies
technologies and
and are
control to be used
engineering. for pedagogical
The graphical
graphicalpurposes, in
capabilities the field
offield
com-of
research
standard effort
for thein the
Internet development
of Things of
(IoT, technologies
sometimes and
In- are
control
control to be used
engineering.
engineering. for pedagogical
The
The graphicalpurposes, in
capabilities
capabilities the of
of com-
com-of
research
standard
standard effort
for
for the
thein the
Internet
Internet development
of
of Things
Things of
(IoT,
(IoT, technologies
sometimes
sometimes and
In-
In- control
puters, engineering.
using images The
or graphical
animations, capabilities
can help of
students com-
to
standard for control
puters, engineering.
using images The
or graphical
animations, capabilities
can help of
students com-
to
ternet
standard
ternet of for the
the Internet
of Everything).
Internet
Everything). Under
Under of Things
of this
Things
this term,
term,(IoT,
(IoT,there
there sometimes
is a network
sometimes
is
is aaatonetwork
network In-
In- puters,
puters, using
using images
images or
or animations, can help students to
ternet
ternet
of of
of
physicalEverything).
Everything).
things or Under
Under
or objects
objects this
this term,
withterm, there
there
connectivity is network
enable puters,
understand
understand
understand usingmore images
more
more
easily
easily
easily or animations,
the
the
the
key
animations,
key
key
can
can help
concepts
concepts
concepts
of
help
of
of
students
the
the
the
system
students
system
system
to
to
ternet
of
of of
physical
physicalEverything).
things
things or Under
objects this
with
with term, there
connectivity
connectivity is ato
tonetwork
enable
enable understand
under study. more easily
Moreover, the key
interactivity conceptsallows of the system
students to
of
dataphysical things
communication or objects
with other with connectivity
devices. Within to enable
the IoT, understand
under
under study.
study. more easily
Moreover,
Moreover, the key
interactivity
interactivity conceptsallows
allows of the system
students
students to
to
of
data
dataphysical things or with
communication
communication objects
with other
other with connectivity
devices.
devices. Within
Within tothe
enable
the IoT,
IoT, under study.
simultaneously Moreover,
see the interactivity
the response
response of the
theallows students
systems to anyto
any
data
there communication
are countless with
devices other
that devices.
can be Within
sensed or the
controlledIoT, under study.
simultaneously
simultaneously Moreover,
see
see the interactivity
response of
of theallows students
systems
systems to
to to
any
data
there
there communication
are
are countless
countless with
devices
devices other
that
that devices.
can
can be
be Within
sensed
sensed or
or the
controlled
controlledIoT, simultaneously
change introduced see the
by response
the user of the
(Dormido systems
et al., to any
2005a;
there are simultaneously
change introduced see the
by response
the user of the
(Dormido systems
et al., to any
2005a;
via
there
via are countless
Internet,
countless
Internet, devices
encouraging
devicesthe
encouraging that
that
the can
can bebe sensed
integration
integration sensed or
or controlled
between
between physical
controlled
physical change
change introduced
introduced by
by the
the user (Dormido et al., 2005a;
via Internet,
via
worldInternet,
and encouraging
encouraging
computer-based the
the integration
integration
systems. between
between physical Sanchez
physical change
Sanchez
Sanchez
et
et
et
al.,
introduced
al.,
al.,
2002).
2002).
2002). the user
by These
These
These user (Dormido
features
(Dormido
features
features
add
add
add
et
to
to
to
al.,
al., 2005a;
et engineering
2005a;
engineering
engineering
via
worldInternet,
world andand encouraging
computer-based
and computer-based the
computer-based systems. integration
systems.
systems. between physical Sanchez
simulations et al.,
rich 2002).
visual These
content features
and theadd to engineering
possibility of an
world Sanchez
simulations
simulations et al.,
rich
rich 2002).
visual
visual These
content
content features
and
and the
theadd to engineering
possibility
possibility of
of an
an
world and can
Educators computer-based
also benefit systems.
from this situation offering their simulations
immediate rich visual
observation content
of system and the
response, possibility
which of an
turns
Educators can also benefit from this situation offering their simulations
immediate
immediate rich visual
observation
observation content
of
of system
system and the
response,
response, possibility
which
which of an
turns
turns
Educatorsnew
Educators
students can ways
can also benefit
also benefit
to fromlearning
from
access this situation
this situation offering
offering
resources their aimmediate
their
without simulation observation
into a of
natural system
and response,
human-friendly which wayturns
to
Educators
students newcan also
ways benefit
to from
access this situation
learning offering
resources their
without immediate
aa simulation
simulation observation
into
into a
aastudentof
natural
natural system
and
and response,
human-friendly
human-friendly which way
wayturns
to
to
students
students
time and new
new ways constraints.
ways
location to access
to access learning
learning
And, in resources
resources
fact, in without
without
the last a simulation
learn, helping into
the natural to and
get human-friendly
useful practical way to
insight
students
time and new ways
location to access
constraints. learning
And, in resources
fact, in without
the last alearn,
simulation
learn, helping
helping into
the
the a natural
student
student to
to and
get
get human-friendly
useful
useful practical
practical way to
insight
insight
time
time
years and
and
the location
location
scientific constraints.
constraints.
community And,
And,
has in
in
devoted fact,
fact,
great in
in the
the
efforts last
last
to learn,
into helping
engineering the student
systems to get
fundamentals. useful practical insight
time
years and
the location
scientific constraints.
community And,
has in
devoted fact,
great in the
efforts last
to learn,
into helping
engineering the student
systems to get
fundamentals. useful practical insight
years the
the scientific community hastodevoted
devoted greateducation
efforts toto into engineering
engineering systemssystems fundamentals.
fundamentals.
years
apply
years
apply the
apply the
the
the
scientific
advances
scientific
advances
advances
community
in these
community
in these
in these fields has
fields
hasto
fields engineering
todevoted
engineering
engineering
great efforts to into
efforts
greateducation
education into engineering
Currently, there systems
are many fundamentals.
tools available to build simu-
apply
(Heck, the advances
1999; Dormido,in these
2004), fields to
yielding engineering
a plethora education
of online Currently,
Currently, there
there are
are many
many tools
tools available
available to
to build
build simu-
simu-
apply
(Heck,
(Heck, the advances
1999;
1999; Dormido,
Dormido,in these
2004),
2004), fields to
yielding
yielding engineering
a
a plethora
plethora education
of
of online
online Currently,
lations of a there
wide are
range manyof tools
systems available
in control to build simu-
engineering.
(Heck, 1999;
interactive Dormido,
tools, 2004),
presented yielding
either as a plethora
simulations of online
or as Currently,
lations
lationstoolsof a there
wide
of aa wide
wide are
range
range manyof tools
systems
of capabilities
systems in available
in control
in control
control to build simu-
engineering.
engineering.
(Heck, 1999;
interactive
interactive Dormido,
tools,
tools, 2004),
presented
presented yielding
either
either as
as a plethora
simulations
simulations of online
or
or as
as lations
These of provide range greatof systems that engineering.
allow to study
interactive tools, lations
These of
toolsa wide
provide range greatof systems
capabilities in control
that engineering.
allow to study
remote
interactive
remote tools, presented
experiences
experiences in real
presented
in real either
either as
plants.
plants. But,
as
But, simulations
as in
simulations
as in IoT, orone
IoT,orone
IoT, as
as These
one These tools
tools provide great capabilities that allow to study
remote
remote
of the experiences
experiences
concerns is in scalability
in
the real plants.
real plants. and But,
But, as in
as in IoT,
interoperability, one
in
the
These
the
the tools provide
behaviour
behaviour
behaviour
of
provide
of
of
the
the
the
great
systems
great
systems
systems
capabilities
under
capabilities
under
under
that
that allow
different
different
different allow to
to study
scenarios,
scenarios,
scenarios,
as
study
as
as
remote
of the
of the
thedue experiences
concerns
concerns is
is in
the
the real plants.
scalability
scalability and
and But, as in
interoperability,
interoperability,IoT, one
in
in the
well behaviour
as countless of the systems
hardware under
drivers todifferent
connect scenarios,
any kind as
of
of
part concerns
to the is the
variety scalability
of devices and andinteroperability,
the intense in
use the
well
well behaviour
as
as countless
countless of the systems
hardware
hardware under
drivers
drivers to
todifferent
connect
connect scenarios,
any
any kind
kind as
of
of
of
part
partthedue
dueconcerns
to
to the
the is the
variety
variety scalability
of
of devices
devices and and
andinteroperability,
the
the intense
intense in
use
use well
device. as countless
In control hardware
enginering, drivers
MATLAB to connect
(The any kind
MathWorks, of
part
of due to the
machine-to-machine variety of
(M2M) devices and
communications.the intense Among use well
device.
device. as countless
In
In control
control hardware
enginering,
enginering, drivers
MATLAB
MATLAB to connect
(The
(The any kind
MathWorks,
MathWorks, of
part
of
of due to the
machine-to-machine
machine-to-machine variety of
(M2M)
(M2M) devices and
communications.
communications.the intense Among
Among use device.
2015) isIn control
the de enginering,
facto standard MATLAB
software (The
tool. MathWorks,
It is a tech-
of machine-to-machine (M2M) communications. Among device.
2015) isIn control
the de enginering,
facto standard MATLAB
software (The
tool. MathWorks,
It is a tech-
of This
 machine-to-machine (M2M) communications. Among 2015) 2015) is
is the de facto computing
standard software tool. Itwhich
is a tech-



This work
This
work has
work
has been
has
been funded
been
funded by
funded
by the
by
the National
the
National Plan
National
Plan Project
Plan
Project DPI2012-
Project
DPI2012-
DPI2012-
nical
2015)
nical
nical is the
and
and
and the de
de facto
numerical
numerical
numerical
standard
standard software
facto computing
computing
environment,
software
environment,
environment,
tool.
tool. It is
is a
Itwhich
whicha tech-
was
tech-
was
was
31303
 This
31303
This
ofwork
of the Spanish
the
work
Spanish
has
has been
been
Ministry
funded
Ministry
funded
of Science
by
of
by
Science
the
the
and Innovation
National
and
National
Innovation
Plan
Plan Project
Project
andDPI2012-
and FEDER
FEDER
DPI2012- nical
born
nical
born and
as
and
as a
a numerical
tool to
numerical
tool to computing
manipulate
computing
manipulate environment,
matrix. But
environment,
matrix. But there
there which
are
which
are was
many
was
many
31303 of
funds.
31303 of the
the Spanish
Spanish Ministry
Ministry ofof Science
Science andand Innovation
Innovation and
funds. of the Spanish Ministry of Science and Innovation and FEDER
and FEDER
FEDER born
born as as a tool
as aa tool
tool to to manipulate
to manipulate
manipulate matrix. matrix.
matrix. But But there
But there are
there are many
are many
many
31303
funds. born
funds.
funds.
Copyright
2405-8963
Copyright 2015
2015 IFAC
2015, IFAC (International Federation of Automatic Control)
IFAC 247
247 Hosting by Elsevier Ltd. All rights reserved.
Copyright
Copyright
Peer review
2015
2015
under IFAC
IFAC
responsibility of International Federation of 247
247
Automatic
Copyright 2015 IFAC 247Control.
10.1016/j.ifacol.2015.11.244
IFAC IBCE 2015
248
November 4-6, 2015. Brescia, Italy Jess Chacn et al. / IFAC-PapersOnLine 48-29 (2015) 247252

other tools, either commercial products such as LabVIEW, first one is the system, a real process or a simulation
Sysquake, Maple, Mathematica, open source tools like created with a standard engineering software that models
Scilab, Maxima, Octave, or even programming languages the process of interest. The second one is the interactive
with numerical computing libraries such as NumPy/SciPy view through which users can observe and manipulate the
for Python, and Numeric.js for JavaScript. Though some system. The client application adds to the underlying (ex-
of these tools have support to develop graphical interfaces, ternal) engineering application an upper layer that allows
usually they are far from being ideal for unexperienced students to interactively manipulate and visualize the re-
programmers to develop interactive tools. sponse of the system. The external application is controlled
by the client application and provides it data for visualiza-
The aim of this paper is to describe an interoperability
tion. But, no matter what kind of software is being used,
protocol for remote and virtual laboratories, based on
there always are some common needs to communicate the
previous work (Sanchez et al., 2002; Dormido et al., 2005b;
engineering system and the interactive view, such as the
Farias et al., 2011; Chacon et al., 2015). The basic needs of
initial configuration, a way to read/modify the value of
an online interactive learning tool are captured in an easy-
the variables or states (for visualization and manipulation)
to-use and easy to implement protocol to help interconnect
and also, depending on the system, a way to control the ex-
human interfaces to engineering simulations.
ecution, pause, or more complex commands. These actions
With this protocol, the development of an interactive can be abstracted from the particular implementation, and
learning tool for engineering can be decoupled in two tasks. captured into a generic interoperability protocol. Ideally,
On the one hand, the model of the engineering simulation the subscription to the protocol should allow a complete
or the interface to the process is created using a special- decoupling between the two components (the system and
ized software like MATLAB, LabVIEW or whatever the the view) in a bidirectional way: on the one hand, an
developer feels comfortable with. On the other hand, the existent model or system can be accessed through different
human interface can be created using another software tool views, for example, to carry out different learning experi-
specialized in the design and implementation of graphical ences on the same system or to present different visual-
interfaces for non-expert programmers as, for example, ization depending on the kind of user. On the other hand,
Easy Java Simulations (EJS, (Esquembre, 2015)). This an interactive view can be shared by different systems.
two components can be easily connected through a well- For example, to connect with different systems depending
defined, simple and effective protocol, having a high-degree on their time availability. Focusing on the interconnection
of independence. between MATLAB and EJS, one have to cope with several
problems. First, there are different approaches to control
In this way, not only the development effort is rationalized, MATLAB from Java, such as compiling the program with
because many software components can be reused and Builder JA to create a Java wrapper, or use a third-party
shared between different interactive tools, but also help library like JMatlink or matlabcontrol that allow to control
the educator focus on the design of the experience and the MATLAB engine/GUI (see (Altman, 2012) for more
the visualization, while devoting less effort to the low-level details). Then the EJS/Java code must be implemented
implementation details. Moreover, if an engineering system to solve the specific problem for the laboratory in devel-
adhere to the protocol, it is even possible to use it without opment. In case there is a need to change the component
knowing these implementation details, but only using the on which the connection relies (due to compatibility issues,
interface to interact with it. This enable a new paradigm a substitution of the engineering software, etc.), the EJS
of design, where physical resources can be shared between application must be modified, requiring additional effort
different universities, having the same or different views to adapt the laboratory. Encapsulating all the interconnec-
and experiences to carry out with the system, depending tion issues into a reusable component, the development can
on the particular needs of each user. Despite from that, be rationalised, and only the components actually involved
there are other cases where it can be useful to reuse a in the change have to be adapted. The communication
model or a system interface. For example, many academic protocol described in the next section shows a simple, but
plants are deployed with some sample software developed powerful application programming interface (API) that
in MATLAB or LabVIEW, to demonstrate the capabilities any engineering software should conform to, in order to
of the system or to propose learning experiences. provide all the features required to effectively implement
The paper is organized as follows. Section 2 describes the interoperate approach.
briefly the creation of standard engineering simulations. In
Section 3 a communication protocol to connect engineering
software with an interactive human interface is presented. 3. REMOTE INTEROPERABILITY PROTOCOL
Section 4 adapts the communication protocol to perform
remote operation of engineering simulations. Finally main
conclusions are discussed. In a common scenario, the client connects to the resource
and acquire basic information about the capabilities of the
system, such as: can I control the execution or only behold
2. BUILDING SIMULATIONS the evolution of the system? what methods can I invoke?
which variables can I obtain from the system? and which
2.1 Overview can I modify?. After the negotiation phase, the client has
obtained sufficient knowledge about the ways to interact
Any interactive simulation that uses a model previously with the system. Taking a close look to the functionalities
created on an existing engineering software can be con- that the engineering system must support, they can be
ceptually separated on two differentiated components. The divided into different categories:

248
IFAC IBCE 2015
November 4-6, 2015. Brescia, Italy Jess Chacn et al. / IFAC-PapersOnLine 48-29 (2015) 247252 249

Connection and session control These methods allow


to establish communication with the server, configure
the execution and, eventually, finish the connection
properly.
Data transmission control Under this category rely
all the methods that can read or modify the state of
the server.
Command execution The client application should
be able to execute server specific commands. Note
that the protocol only specify the way of sending
commands. The interpretation of these commands is
responsibility of the server, and as that, these can be
as simple or as complex as the server necessities. For
example, in the case of MATLAB, the client can send
MATLAB code.

3.1 The basics

Using the KISS principle 1 (Dalzell, 2008), the API has


been kept reduced to a minimum set of methods, yet
covering all the basic functionality: 2
connection control
connect()
disconnect()
data transmission
get(variable) Fig. 1. Sequence diagram of a typical session: First, the
set(variable, value) client connects to the server and get info about
session control its capabilities. Once established the connection, the
start() client synchronize variables and send commands to be
stop() evaluated by the server. Eventually, the client finalize
open(file) the session, freeing resources for future connections.
close(file)
command execution disconnect() - This method allows to finalize the
eval(command, schedule) connection with the server in a properly way, closing
step() any opened resource that client might have opened.
Figure 1 shows a sequence diagram corresponding to a Data transmission With respect to data transmission,
typical session. After establish the connection, usually the usually both methods get and set are needed. But because
client enter into a loop where periodically updates the some systems may be only readable or writable, the
values of some variables in the server, executes one or more method get must be implemented if there are readable
commands and ask for the new values of the variables variables reported, being the same valid for the method
of interest. The following paragraphs contain, for each set and writable variables.
method, a brief description of the purpose and parameters
expected. The following lines detail how each method must get() - Receive a variable or list or variables from the
be defined. ones reported by the server as readable, and returns
the values of that variables.
Connection Control The implementation of the con- set() - Receive a variable or list or variables from the
nect() and disconnect() methods is mandatory, because ones reported as writable by the server, together with
the system must provide a way of establish and finish the the values to be assigned.
connection in a proper an orderly way.
Session control The session control methods and com-
connect() - For the handshake, the server has to mand execution are optional, i.e. they can be implemented
inform a few things to the client: or not, because they depend on the capabilities and com-
A list of the methods that are actually provided plexity of the server. Under some circumstances, for exam-
by the server, since there are optional methods ple, it could be useful to load a file in the server, start/stop
than may or may not be implemented. the execution of a simulation, etc. But, as opposed to the
A list of all the variables available in the server, methods discussed before, they are not always needed. So
indicating whether they can be read, written or it does not make sense to require the implementation for
both. all systems.
1 Keep it simple, stupid principle states that simplicity should be a
primary design goal, avoiding unncecesary complexity. It was noted open() - An invocation of the method open provokes
by the U.S. Navy in 1960. the opening of an element, which can be an experi-
2 The mandatory methods are formatted as monospaced, and the ence, access to a hardware resource of whatever the
optional methods are formatted as italic. server needs to expose.

249
IFAC IBCE 2015
250
November 4-6, 2015. Brescia, Italy Jess Chacn et al. / IFAC-PapersOnLine 48-29 (2015) 247252

close() - A call to the method close() has as result the


closing of a resource that has been previously opened.
start() - In case the execution of the server can be
controller by the user, that must be done with a call
to the method start(). This is useful, for example, to
run a simulation.
stop() - A call to the method stop() provokes the
stop of the activity began with an invocation of the
method start().

4. EXAMPLE OF IMPLEMENTATION

A reference implementation is provided based on the


JavaScript Object Notation (JSON) and JsonRpc v2.0
(JSON-RPC Working Group, 2015). The implementation
relies on three components:
An RpcMatlabServer, a service running in the PC in
which MATLAB is installed. It implements the Json-
RPC v2.0 protocol and provides the API described
in Section 3, making use of the matlabcontrol library
(Matlabcontrol, 2015; Altman, 2012).
A Java implementation of RpcMatlabClient, which
provides access to the API at the client side, encap-
sulating the jsonrpc implementation details.
An EJS Model Element, which provides a high-level Fig. 2. The implementation relies on three components: An
interface and some utility methods to incorporate into RpcMatlabServer, a service running in the PC which
an EJS simulation. MATLAB installed, an RpcMatlabClient, which pro-
vides access to the API at the client side, and an EJS
4.1 The RPC server model element, which provides a high-level interface
and some utility methods to incorporate into an EJS
The RPC server has been implemented in Java, and it simulation.
is deployed as a jar file that runs in the PC where the 2 " jsonrpc " : " 2.0 " ,
MATLAB Software is installed. Though the internal de- 3 " result " : {
tails are not discussed, the general architecture is depicted 4 " session_id " : " b5224563 " ,
in Figure 2. The class MatlabConnector implements the 5 " methods " : [
RIP API as a facade to make use of the matlabcontrol 6 " connect " ,
library, which allows to establish a local connection with 7 " disconnect " ,
MATLAB to send commands and access the MATLAB 8 " get " ,
workspace. The class RpcMatlabServer is responsible of 9 " set " ,
10 " eval "
exposing the API through the protocol JsonRpc v2.0. For
11 ],
this purpose, it use the library libjsonrpc, which have also 12 " read " : [ "t" , "x" , "y" , "u" ] ,
been developed by the authors. 13 " write " : [ " t " , " x " , " y " , " u " ] ,
The implementation of the API methods are detailed 14 },
15 " id " : " 02 b25611 -021 c -4604 - ad6f -32 adbbdf00d2 "
in the following paragraphs, providing excerpts of the 16 }
client/server dialogues for each method call.
The id field allows to bind a response to an invoka-
connect() - An invocation of the method connect() tion. The server fills this field with the corresponding
ends with one of the following results: value sent by the client, so that it can be correctly
A new connection with the server is created, interpreted.
registering the user for supervision or control of disconnect() - A call to the method disconnect()
the hardware, and returning an identifier which provokes the server to finish the client session. Since
can be used to reference the open connection. the method does not expect response, there is no
An error response if there was any problem with need to send the id field. An example of disconnect()
the connection. invokation is:
In JsonRpc:
1 {
1 { 2 " jsonrpc " : " 2.0 " ,
2 " jsonrpc " : " 2.0 " , 3 " method " : " disconnect " ,
3 " method " : " connect " , 4 " params " : " b5224563 " ,
4 " id " : " 02 b25611 -021 c -4604 - ad6f -32 adbbdf00d2 " 5 }
5 }
set() - The methods set and get are used to directly
And the server responds: read and write the variables provided by the server.
1 { The method set receive two params: a variable (or

250
IFAC IBCE 2015
November 4-6, 2015. Brescia, Italy Jess Chacn et al. / IFAC-PapersOnLine 48-29 (2015) 247252 251

list of variables) to be modified and the new value(s).


For example, the following call set the value of the
variable u to the vector (0.0, 1.0, 2.0).
1 {
2 " jsonrpc " : " 2.0 " ,
3 " method " : " set " ,
4 " params " : [ " u " , [ 0 . 0 , 1 . 0 , 2 . 0 ] ]
5 }

get() - The method get receive one param: the vari-


able (or list of variables) requested. For example, to
obtain the value of the variable x :
1 {
2 " jsonrpc " : " 2.0 " ,
3 " method " : " get " ,
4 " params " : [ " x " ] ,
5 " id " : " 78 ab4cf2 -05 e8 -411 b - b05c - f5fecf73e3ac "
6 }

eval() - The method eval() allows to execute com- Fig. 3. The MatlabConnector element is an EJS add-on
mands provided by the server (in this case, any MAT- which can be incorporated into an EJS simulation,
LAB command). just dragging and dropping, to add connectivity with
a MATLAB/Simulink model. The configuration dia-
1 {
2 " jsonrpc " : " 2.0 " ,
log of the element allows to introduce the server URL,
3 " method " : " eval " , the variables that should be synchronized, and some
4 " params " : [ " y = cos ( w * t ) ; " ] , additional options.
5 }
7 {
8 " jsonrpc " : " 2.0 " ,
By default, the command is immediately evaluated after 9 " method " : " eval " ,
the invocation is processed. A second argument will allow 10 " params " : [ " y = cos (2* pi * f * t ) ; " ] ,
to specify a scheduling, for example now or every 10 11 },
ms. But currently only the immediate execution is imple- 12 {
mented. 13 " jsonrpc " : " 2.0 " ,
14 " method " : " get " ,
4.2 The RPC client 15 " params " : [ " y " ] ,
16 " id " : " 78 ab4cf2 -05 e8 -411 b - b05c - f5fecf73e3ac "
The basic API provided by the server can be used to 17 }
control a MATLAB session at the client side, evaluat- 18 ]
ing commands and synchronizing workspaces. A common
functionality which is needed very often is the execution 4.3 The EJS Element
of a simulation step by step. Here a step is understood as
a sequence of three actions:
The implementation of the API has been encapsulated
Update the value of several variables (usually the inside an EJS element so, in order to enable the current
input of the model or system) simulation to communicate with a MATLAB server, the
Execute a command, for example to integrate a time interface designer only have to drag an icon from the
interval of a simulation model, to update a controller, library and drop to the current simulation (see Figure 3).
etc. Then, some configuration is required. At a minimum, the
Read a set of variables which have been affected by URL where the server is listening. Once the element has
the command executed. been configured, the API described in Section 3 can be
accessed through the instance added to the simulation.
This actions can be decomposed as three successive invoca-
To implement the cosine computation example, a new
tions of the methods set(), eval(), and get(). For example,
Initialization page is created with the following code (see
suppose the client want to use the MATLAB server to
Figure 4):
compute the value of the expression y = cos(wt) over the
time (though it is like using a sledgehammer to crack a matlab . c o n n e c t ( ) ;
1

nut, the example is functionally similar to the execution 2 matlab . e v a l ( " w =2*3.1416*1; t =0; " , " at init " ) ;
of a complex MATLAB model). A way of doing that is
using a batch call (sending different method calls in one where the first sentence connects to the server, and the sec-
message). An example of such a call codified in JsonRpc: ond one sets a command to be evaluated at the initializa-
tion phase. Then, an Evolution Page is created containing
1 [
the code to be periodically executed:
2 {
3 " jsonrpc " : " 2.0 " , 1 matlab . s e t ( " t " , t ) ;
4 " method " : " set " , 2 matlab . e v a l ( " y = cos ( w * t ) ; " , " now " ) ;
5 " params " : [ " t " , 1 . 0 ] 3 y = ( double ) matlab . g e t ( " y " ) ;
6 }, 4 t += 0 . 0 5 ;

251
IFAC IBCE 2015
252
November 4-6, 2015. Brescia, Italy Jess Chacn et al. / IFAC-PapersOnLine 48-29 (2015) 247252

Fig. 4. The Initialization pages allow to introduce lines of Fig. 5. The Evolution pages allow to introduce lines of Java
Java code that should be runned at the initialization code that should be runned at every integration step
of the simulation. On the left, the code corresponds to of the simulation. On the left, the code corresponds to
the low-level commands approach. On the right, the the low-level commands approach. On the right, the
code is introduced through the configuration dialog. code is introduced through the configuration dialog.
REFERENCES
the update of the variable t is sent to the server, then the
Altman, Y. (2012). Undocumented Secrets of MATLAB-
command is executed and finally the value of y is requested
Java Programming. CRC Press.
to the server. As mentioned, this approach uses the low-
Chacon, J., Vargas, H., Farias, G., Sanchez, J., and
level API calls. But there are another possible approaches.
Dormido, S. (2015). EJS, JIL Server and LabVIEW:
For example, using the step definition given before, one can
How to build a remote lab in the blink of an eye.
configure the element to automatically get ride of all these
Learning Technologies, IEEE Transactions on. doi:
actions:
10.1109/TLT.2015.2389245.
Synchronize the variables t and y between EJS and Dalzell, T. (2008). The Routledge Dictionary of Modern
MATLAB. In this case, the variables at both sides American Slang and Unconventional English. Taylor
has the same name, but this is only for convenience, Francis.
not a requirement. Dormido, S. (2004). Control learning: Present and future.
Run a command at initialization, i.e. after the first In Annual Reviews in Control, volume 28, 115136.
call of the method start or step. Dormido, S., Dormido-Canto, S., Dormido, R., and
Set the command to be executed every time the Sanchez, J. (2005a). The role of interactivity in con-
method step is invoked. trol learning. The International Journal of Engineering
Education, 21(6), 11221133.
Dormido, S., Esquembre, F., Farias, G., and Sanchez,
J. (2005b). Adding interactivity to existing simulink
5. CONCLUSIONS
models using easy java simulations. In 44th IEEE CDC-
ECC05, 41634168.
The work has focused on the definition of a protocol Esquembre, F. (2015). Easy Java Simulations home page.
to specify how engineering systems must publish their www.fem.um.es/Ejs.
services in order to be able of decoupling from the user Farias, G., Dormido, S., and Esquembre, F. (2011). Inter-
interface that allow access to them. The common require- active Human Interfaces with Engineering Software. In
ments, which usually cover the functionalities of connec- 18th IFAC World Congress.
tion and session control, data transmission control, and Heck, B. (1999). Special report: Future directions in
user interaction handling, have been captured into an control education. IEEE Control Systems Magazine,
interoperability API. In this way, not only the development 19(5), 3558.
of these system is rationalized, but it provides with new JSON-RPC Working Group (2015). JSON-RPC 2.0 Spec-
possibilities like for example the development of different ification. http://www.jsonrpc.org/specification.
interfaces that can access the same engineering system, or Matlabcontrol (2015). matlabcontrol home page.
vice-versa, a unique interface that can connect to different https://code.google.com/p/matlabcontrol/.
systems, depending on the availabilty. The benefits of Sanchez, J., Morilla, F., Dormido, S., Aranda, J., and
this approach is studied in an example of implementation Ruiperez, P. (2002). Virtual and Remote control labs
using MATLAB, a well-know engineering software, and using java: a qualitative approach. IEEE Control Sys-
EJS, a software tool commonly used to create interactive tems Magazine, 22(2), 820.
simulations. The API is implemented with JsonRpc v2.0, The MathWorks (2015). MATLAB home page.
which allows to be deployed over the Internet in a portable www.mathworks.com.
manner.

252

You might also like