grapedraughtΛογισμικό & κατασκευή λογ/κού

2 Δεκ 2013 (πριν από 4 χρόνια και 5 μήνες)

94 εμφανίσεις

Development of MATLAB and Google Earth Components for the TCASE Framework


Grumman & The TJHSST Computer Systems Lab

July 2006
January 2007

Lee R. Burton

Christopher D. Demaree


This paper describes the the development of two
separate co
mponents for the TASC Component
Architecture and Simulation Environment
(TCASE) framework. One is the development of
a MATLAB web service in which MATLAB is
made accessible over the network by a Java web
service via XML service calls. The other is the
velopment of a prototype Google Earth
visualization service that currently has basic
three dimensional display and animation

1 Introduction

MATLAB is a matrix math computing
environment and programing language. We have
made it available to the
TCASE framework so
that other components can preform MATLAB
operations without directly interfacing with
MATLAB, or even knowing where the
MATLAB operations are being preformed.

Google Earth is a visualization tool that allows
for arbitrary objects to b
e placed inside its
environment via KML. KML is a set of XML
guidelines put out by Google. Google Earth is
being explored as a possible three dimensional
visualization tool for the TCASE framework.

2 Background

The development of these components for
CASE framework is to expand an existing set
of components. MATLAB was used previously
to do offline analysis (such as create view sheds),
but this MATLAB component abstracts the way
that other services make can use of MATLAB
with interactive calls.

ently the TCASE framework is making use
of End
end Modeling PROving and
Visualization Environment (EMProVE) to do 2d
visualization. TCASE's predecessor, EENM
made use of nVisualizer from nanoTITAN, a 3
network visualization provider.

3 Creation of a

MATLAB Web service

The creation of a MATLAB web service was
done with the help of three existing pieces of
software: Apache Axis 2, Apache Tomcat, and
JMatLink. Axis 2 is a SOAP engine that we are
running on top of Tomcat, Apache's serverlet and
JSP imp
lementation. JMatLink connects Java to
MATLAB by using the Java Native Interface
(JNI). The MATLAB web service was created
by writing an Axis 2 application that used
JMatLink to communicate with MATLAB via its

TCASE Framework <
> SOAP Traf
fic <
Tomcat <
> Axis 2 <
> MATLAB Service <
JMatLink <
> JNI <

The Axis 2 SOAP engine is not fully
documented, but existing TCASE classes
allowed for easier data transport through Axis 2.
The TCASE envelope class allows a developer to
sulate other objects into messages. It
handles the serialization and deserialization of
data for the service. After figuring out the quirks
of the preexisting envelope class it was fairly
simple to start to encapsulate Java Array and
Java Image objects i
nside of envelopes. All of
the methods in the MATLAB service return
something, so they are all of RawXMLINOut
Axis 2 messageReceiver type. We decided it
would be better to confirm the successful
execution of each method, even if it wouldn't
normally fail

or send data back. The methods in
the MATLAB web service are similar to that of
JMatLink with four additional methods
(Appendix A). One method is t_active, which
gives the current status of the MATLAB service.
The other three methods are related to the

transportation of Mfiles (MATLAB language
file). The t_getMFileLocation and the
t_getMFileLocation methods allow the
framework to get and set the directory in which
Mfiles are stored (hopefully where MATLAB
knows to look for the files). t_putMFile al
for the framework to send the MATLAB service
a Mfile to put in the MFileLocation. This allows
more complex MATLAB code to be executed.

Currently the MATLAB service allows for:

* Putting M files into a specified location by
sending the full text to t
he service (t_putMFile)

* Putting Java arrays into MATLAB

* Getting MATLAB arrays into Java

* Getting MATLAB figures into Java Image

* Putting Java Scalars into MATLAB

* Getting MATLAB scalars into Java

* Evaluating a MATLAB command (string)

* Gett
ing the MATLAB Output buffer

The MATLAB web service is meant primary as a
backend application, and all job
management/queuing of jobs will be handled by
the framework (with the help of the t_active

3.1 Testing the MATLAB service without the
ASE Architecture

To test the MATLAB service, we implemented a
test client that will eventually be developed into
code for the framework. The test code sets
MfileLocation, puts an Mfile, and then runs the
mfile. It then pulls the output (in this case the

surf(peaks) in Appendix B).

4 Prototyping of a Google Earth Visualization

The first steps to prototyping a Google Earth
Visualization service was learning how to
interact with Google Earth, and Google
facilitates this with the KML XML guideli
Our testing Google earth code was mostly hand
written/generated KML with changing variables
to facilitate animation.

4.1 PHP/Apache Test Code & KML

KML allows for updates to be sent to update an
initial KML (see init.kml in Appendix D). To

these updates come automatically we load
in a KML with two “NetworkLink”'s one that
points to our init.kml, and one that points to our
PHP updater script (see tcase.kml in Appendix
D). The first thing our PHP updater script does
is create all the objects

for the simulation through
an Update and Create call:




<Document targetId="tcase">

<Placemark id="uav0">


On the next poll of the PHP updater, the updater
s the values for things such as altitude,
orientation, lat, lon to animate the objects. We
have successfully run this with 20 objects
moving at a 0.1 second update interval, and we
suspect that it will scale fairly well. It moves the
objects with a Updat
e and a Change call:



<Location targetId="uav0

<longitude><?php echo

Only objects with ID's can be changed, so we
gave pretty much everything an ID. As far as we
can tell, subobjects

(such as location object of the
UAV object) can not be changed without having
their own ID. At the end of a given a simulation,
the PHP script removes all the objects it created
in the beginning. A front end made with PHP/
AJAX allowed for control of t
he simulation
inside Google Earth via its integrated web
browser. Currently it allows for control of the
speed at which the objects move, and the time

4.2 Google Earth KML Auto

Currently Google doesn't provide a KML
specification, but ou
r XML data binding
solution, JiBX, doesn't need a XML
specification. JiBX makes use of binding files,
and allows you to “marshall” and “unmarshall”
XML files. The binding file is a translation of a
Java class representation of the data and the
XML repres
entation of the data. We have been
working on a JiBX binding file for KML so that
we can auto
generate entire KML documents
with Java and JiBX just by marshalling from a
Java class. The Google Earth Java class being
developed would be populated with data

asking the TCASE framework for XML updates.
The TCASE framework already has JiBX
binding, so after the Google Earth bindings are
completed, all that needs to be done is a
translation from the TCASE Java class to the
Google Earth Java class. The final

layout of the
Google Earth visualization service would look
something like this:

MySQL with state info <
> Framework <
Google Earth component <
> Google Earth

5 Conclusions

The Google Earth component will need to be
able to quickly serve Google Earth'
s requests,
while also, loading/preloading data from the
framework. It may be a good idea to have two
threads, and a separate data store for the
component, so that one thread serves Google
earth while the other adds more data to the data
store from the fr

The MATLAB service will be useful for other
services to use, but may need additional features
to be implemented. It may be possible to support
animations if we can find a good way to quickly
take Java Image's and encode them into a video

6 References and Appendixes

EENM Whitepaper (ARN:

Apache Axis 2 Documentation

Apache Tomcat Documentation

JMatLink Documentation

6.1 Appendix A: Annotated MATLAB services.xml

<serviceGroup name="Matlab">

<service name="MatlabService" scope=

<description>Matlab Service</description>

<parameter name="ServiceClass" locked="false">



<operation name="t_active"><!

Returns whether or not it is currently active

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engEvalString"><!

Evaluate a string in MATLAB

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engClose"><!

Close MATLAB Engine

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engOpen"><!

Open MATLAB Engine

.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engGetFigure"><!

Get a Figure from MATLAB (as a Java

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


ration name="t_engGetArray"><!

Get an array from MATLAB

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engPutArray"><!

Put an array into MATLAB

s="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_putMFile"><!

Put an Mfile into a directly in the path of

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_setMFileLocation"><!

Set the directory to put MFiles

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_getMFileLocation"><!

Get the directory Mf
iles are put into

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engGetCharArray"><!

Get a character Array from MATLAB

s.RawXMLINOutMessageReceiver" />


<operation name="t_engGetOutputBuffer"><!

Get MATLAB's output buffer

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />


<operation name="t_engGetScal

Get a scalar from MATLAB

class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />




6.2 Appendix B: Example MATLAB Figure

6.3 Appendix C: Google Earth Screenshots

6.4 Appendix D:


<?xml version="1.0" encoding="UTF

<kml xmlns="http://earth.google.com/kml/2.1">

<Document id="tcase">




<?xml version="1.0" encoding="UTF

<kml xmlns="http://earth.google




<description>TCASE Scenario</description>







tion>TCASE Scenario UPDATER</description>

<Link id="updater">