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heLR`rRdO~JhVXWm]hXiQZ[RQ\&]{k7HbX[SlXH`] JhVHdJJhVXtm]hXiQbHd`_iR RSeq`sHd`7uyXi&HSleq`Xtk~RQhJheLR`7].RO JhVX]{eLn`HKL]Peq`5S_RQhXjuXJHeqK~ZteqJhVRm&JfVH/p eL`nJRQhXQhm`lJhVXHd`HKqv&]heL]XHbFVlJeqSlXcTWVXiR RSleL`nyH`ulkKgH/vM7HbF\yRO JhVX]{eLn`7HdKg]eg]PHbbRS_kKqeg]{VXusm]heL`nyH/p/HyHdkkKLXJF]JVHJWHdQXu&RZt`KLRHu&Xu_JRJVXm]hXiQ ]PMQRZj]hXiQc.TWVeg]PXiHdSlkKLX
Form Approved OMB No. 0704-0188
Report Documentation Page
Public reporting burden for the collection of information is estimated to average 1 hour per response, including the time for reviewing instructions, searching existing data sources, gathering and maintaining the data needed, and completing and reviewing the collection of information. Send comments regarding this burden estimate or any other aspect of this collection of information, including suggestions for reducing this burden, to Washington Headquarters Services, Directorate for Information Operations and Reports, 1215 Jefferson Davis Highway, Suite 1204, Arlington VA 22202-4302. Respondents should be aware that notwithstanding any other provision of law, no person shall be subject to a penalty for failing to comply with a collection of information if it does not display a currently valid OMB control number.
1. REPORT DATE
2. REPORT TYPE
20 AUG 2004
N/A
3. DATES COVERED
-
4. TITLE AND SUBTITLE
5a. CONTRACT NUMBER
A Java based web interface to Matlab
5b. GRANT NUMBER 5c. PROGRAM ELEMENT NUMBER
6. AUTHOR(S)
5d. PROJECT NUMBER 5e. TASK NUMBER 5f. WORK UNIT NUMBER
7. PERFORMING ORGANIZATION NAME(S) AND ADDRESS(ES)
8. PERFORMING ORGANIZATION REPORT NUMBER
The Ohio State University Columbus, OH 43210 9. SPONSORING/MONITORING AGENCY NAME(S) AND ADDRESS(ES)
10. SPONSOR/MONITOR’S ACRONYM(S) 11. SPONSOR/MONITOR’S REPORT NUMBER(S)
12. DISTRIBUTION/AVAILABILITY STATEMENT
Approved for public release, distribution unlimited 13. SUPPLEMENTARY NOTES
See also ADM001694, HPEC-6-Vol 1 ESC-TR-2003-081; High Performance Embedded Computing (HPEC) Workshop (7th)., The original document contains color images. 14. ABSTRACT 15. SUBJECT TERMS 16. SECURITY CLASSIFICATION OF: a. REPORT
b. ABSTRACT
c. THIS PAGE
unclassified
unclassified
unclassified
17. LIMITATION OF ABSTRACT
18. NUMBER OF PAGES
UU
45
19a. NAME OF RESPONSIBLE PERSON
Standard Form 298 (Rev. 8-98) Prescribed by ANSI Std Z39-18
Abstract
Presentation
Back to Agenda
Next Abstract
. eLnmQhXl§P&v ]{JhXS¨RpXQhp eLXiZ ]{v&]{JhXiS¨HKL]hRl]{VRZj]fVRZJRrm7]{XH/pH_HdJHMH]hX
fR``XbJheLp ezJ4vI©(j
WªJR_HbibiX]][H`uBSsH`eqkmKLHdJhXJhVX]heqn`HdK uHJFHdMH]{Xc j`:eqSlk~RQhJH`JHkkKLeLbHJeqR`ERO]hmbFVYHs]hv ]{JhXS«eg]jHlQX]hXHdQFbFV5RQheLXi`JXu=ZfXMEk~RQhJHKZtVXQhXHlbRSlSym`eqJ4v5RO ]hbieqX`JeL]{J]WH`uBQX]hXHQbFVXQ]PbiHd`E]{V7HdQXuHdJH_Hd`u=bR&u&XZtezJV5XHbFV5RJhVXQcTWVXk7RQ{JFHdK¡biH`5HdKLKLRZHdm&JVXi`JhegbiHdJhXu m]{XQ].JRu&RZt`KqRHuGITt.2biR uXfZtVegbFVyeg].JhVX`reLSlSlXu&egHJXiKLvH/p/HeqKgHdMKqXPJhRRdJhVXiQm]hXiQF]JRJX]{JH`uXiHdSleq`X QhX]{mKqJ]cj` v_]hk~XbegHdKLeLiXu_JR RKLM7R/&X]QhX£meqQXu_`XXusM~XjVR]4JXulR`Kqv_R`_JhVX]hXiQpXiQ]hv&]4JXiSQhm``eL`nyGITt. Hd`uE`XXu=`RdJjM~XQhXkKLeLbHJhXu=HdJtXHbFVEm]hXiQj]hezJXc TWVeL]+ZfRQh\ZWH]]hmkk~RQhJhXueq`ykHdQhJ+M vJVXfR¬eqnVXiQhO>RQSlH`bXf
fRSlkm&JheL`nGIR uXiQ`eqHJeqR`QRnQFHdS: ] P®PT0kQRnQFHdS:c ¯ ! c7cjm`JhXQHd`7u5°c~
fQFH/ZWO>RQFu¡N¡±&²³²l´¡µ¶}³·qµi¸¹[¶ºh»¶h²¼_¼_½¿¾»N r ÀtXieLKqKLv5ÁÂ]]{R&begHJX]N¥rXu¡cLN7¥dÃà ¥&crcÀc+
[HdKLKLH/ZWH/vEH`uIrc.
fRZ[HQuNľÅ}½,Ƶs´µi¶}³·qµi¸(ÅÇr´¡µ¶}³µi¶}È ´7½,Ƶr¹[¶hº»d¶h²d¼r¼_½¿¾»yɺ¶l¸>ʵs±&²³²&ËiÌÍlÎB¹W·q²¸ÏÈ Éº¶}¼_N7uu&eL]hR`Ï%X]hKqXv5mMcf
fRcLN¥`u=XucqN7¥Ãà ¦c°cÀc~JhXpXi`7]iNWСÑÄ{ÒÑyµi¸(ÓPºd¶hÔr¹[¶ºh»¶h²¼_¼_½¿¾»NQXi`JhegbXHdKLKPTtÀN7¥rXu¡cqN+ÕÕÖ ×c.G"Tt+AHd`uG"Tt+"AXMy XiQpXQu&R&bmSlX`JFHJeqR`O>QRSØGIHJV%RdJh\&]N/^a`bdcLNÊ&¸(¸zÙ¡Ç ÚÚ7ÓÓÓPÛL¼s²¸>Ê ÓPºd¶hÔ/ÅiÛ¿ÜFº¼ Ý cP m`YGYegbQR]hv&]4JXiSs]NÊ&¸(¸zÙ¡Ç ÚÚÞi²d³/²ÛqÅFß&¾Û¿ÜFº¼ à cTWVXjk7HbFVXy RO¿J4Z[HQhXRm`uHdJheLR`N7Ê&¸(¸zÙ¡Ç ÚÚ7ÓÓÓPÛ¿²FÙ²Üʵۿºd¶(» á cTWVXHd\HdQhJH_QRdâ4Xb}JN7Ê&¸(¸zÙ¡Ç ÚÚÞi²Ô²d¶}¸ ²Û¿²Ù²ÜFʵۿº¶(» ¥
Abstract
Presentation
Back to Agenda
Next Abstract itiniftwmmi
SS2MS A Java based web interface to Matlab Siddharth Samsi, Ashok Krishnamurthy, Stanley Ahalt, John Nehrbass, Marlon Pierce
IPS LAB.
Outline • • • • • • •
Motivation and Goals Matlab Web Server from MathWorks The OSU Matlab Application Portal Steps for creating a typical portal application An example Matlab application using the portal Advantages and Limitations Future work
IPS LAB.
Motivations • Matlab is a widely used computational environment for research and development • Many large applications continue to be developed and deployed using Matlab • Researchers from geographically distributed locations want to share applications and data • Users want to run Matlab applications without having to buy licenses for all toolboxes • Solution: A secure, web based Matlab application portal that allows researchers to upload code, run applications and visualize results IPS LAB.
Goals • Create a portal capable of running Matlab applications over the web • Provide the ability to interactively zoom and examine 2-D and 3-D plots • Provide the ability to upload Matlab code for testing and benchmarking on common data • Provide secure access to the Matlab application portal through user authentication and encrypted communication
IPS LAB.
Goal Network Network
□
*!■■ ■'■■■!■
https
User 1 https
* M* User 2 Database
Sensor data
IPS LAB.
Benefits of Research Portal • Provides common platform for sharing data • Enables easier sharing of code and results with the entire research community • Single web based environment can provide easy access to all analysis tools • Web interface can also be used to perform batch processing tasks more easily
IPS LAB.
Matlab Web Server »-•im *t*t ■>' '*•«*■' KKI« Ltiua P-ik- IV i™>i »i|
• Interface between the web and Matlab • Uses Common Gateway Interface (CGI) to provide web based communication • Provides helper functions for creating output HTML from result data • Enables any Matlab application to be accessed over the web
«3 BW
EÖ
I«IH1&~».
'Pit
l«i.»i ly IT»'- h-ii ■*'!> |- iK (Wut) ^*" 1«1 fti W -«(1 * 1 rl-l II **1^ - -
Results
IPS LAB.
Limitations of Matlab Web Server • Matlab workspace is not retained – All variables and data generated by an application is lost upon completion of the program – Results need to be recomputed for subsequent analysis by other applications
• Does not provide interactivity with Matlab graphical output • Difficult to track users – The system does not have a concept of sessions
• Does not provide network security – No data encryption provided – User authentication not provided IPS LAB.
The OSU Matlab Portal • Based on standard open source industry components: Apache, Tomcat, Linux, MySQL • Java technology used to build a web interface to Matlab – Matlab includes a Java Virtual Machine (JVM), providing access to Java objects
• Java servlets enable web based communication • Kerberized Java sockets facilitate communication between Matlab an servlet • Secure socket layer (SSL) used for encryption of all communication over the web IPS LAB.
System Overview Matlab 1
. . . .
Matlab n
Kerberized sockets Servlet Thread 1
a
User 1
. . . .
Matlab portal running Tomcat servlet container
Servlet Thread n
https connections over the web
a User n IPS LAB.
Java Servlets • Java servlets perform the following functions – Authenticate users – Start a new Matlab process for each new user – Communicate with user’s browser using the https protocol – Communicate with user’s Matlab process using kerberized sockets – Track users through sessions
IPS LAB.
Kerberos, Java Sockets and Servlet • The Kerberos mechanism is used for secure message exchanges using sockets • The OSU Matlab portal uses Kerberos V5 mechanism for secure communication • Kerberos ticket required for establishing credentials and secure communication • Kerberos tickets expire when user logs out of the portal
IPS LAB.
Kerberos based communication • Once a user is authenticated and logged in, a unique Kerberos ticket is generated • Communication process: – Connection is established between Java socket and Servlet – Socket and Servlet instantiate a new security context for communication – Using the Kerberos ticket the Socket and Servlet mutually authenticate and exchange tokens for encryption – All communication between them is now encrypted using previously exchanged tokens IPS LAB.
Database Access using JDBC • Matlab provides the ability to access Java objects • Custom Java classes and Java Database Connectivity (JDBC) are used to accesses databases • Matlab can extract data from JDBC compliant databases using these classes • Provides independence from the Matlab Database Toolbox
IPS LAB.
User Login Process Java
Internet Internet
Servlet
https protocol
New Matlab process
Kerberos based encryption
Matlab
Kerberized Java Socket
in CIE IPS LAB.
Designing Portal Applications • Create necessary Matlab m-files • Input to Matlab – Obtained from user, over the web – HTML forms can be used
• Output from Matlab – Results are displayed in the user’s browser – Necessary HTML can be created in Matlab as a string – Can use templates for generating output HTML
• Modification of configuration file – New applications should be registered with the server IPS LAB.
Input from user to Matlab • Input parameters to Matlab obtained from the web • Standard HTML forms can be used to obtain user input • HTML forms support input in the form of – Plain text – Pull down menus – Boolean operators (e.g.: HTML Radio buttons)
IPS LAB.
Sample Input HTML Channel: Contrl_Arro_V Lat__Accel Brake_ON Inter_Accel_V Rear_Accel_V
Call Callservlet servletto to send sendrequest request to toMatlab Matlab
Name Nameof ofapplication application m-file m-fileto torun run
Start time (0 to 999): End time (0 to 999):
.Jas -~> - -, - J J 3 a~.i. _■!•... - «~ J > J 5 - J *• J
Ml— v I - ... i ~ -
OHIO SDMT
I-
'■ ■
-
.'
Dvpurtnunt «>l EUiirknl Kn»iiu-u m"
i «r--iy.ii •*» •«*■ rt«*tl"'
List Listof ofparameters parameters for forthe thespecified specified application applicationm-file m-file
$iwKr«HI»»»H
3 • "-~
IPS LAB.
Output from Matlab • Results from Matlab are displayed in the user’s browser • Output HTML can be created as a Matlab string – Application m-file responsible for adding necessary HTML tags – Data from Matlab should be converted to appropriate form
• Use of HTML templates – Helper functions are provided to substitute the appropriate data into a template – Simpler to change the way results are displayed IPS LAB.
Sample Output HTML using templates Matlab over the web
x = #x#
y = #y#
CjDcw
3" * 1'temtt
IPS LAB.
Deploying OSU Matlab Portal • Core OSU Matlab components – Java Servlets and classes – Matlab m-files – Basic HTML web pages
• Software and Libraries required – Virtual Network Computing (VNC): Needed for providing Matlab with a virtual X-display – Kerberos clients – Tomcat servlet container – Java SDK – Apache Ant: Needed for compilation of Java source – C compiler IPS LAB.
Installing the OSU Matlab Portal • Shell scripts are provided to aid the installation of the portal • Shell script performs following functions: – Creating the necessary directory structure – Reading environment variables and modifying the Java source code accordingly – Compilation of all source code – All class files, Matlab m-files and configuration files are put into appropriate directories – Cleanup: Removal of intermediate files
IPS LAB.
Registering Portal Applications • Any new Matlab application to deployed must be registered with the portal • For this, a configuration file is provided: deploy.xml • deploy.xml contains: – – – –
Application name Input parameters expected and their names Database to used, if needed Application m – file name
IPS LAB.
Sample Configuration file deploy.xml dbvisual } 2 channel stop
Application Applicationname name
List Listof ofinput inputparameters parameters
atcdata }
Database Databaseto tobe beused used
dbvisual }
Application Applicationm-file m-file
IPS LAB.
Limitations • Matlab memory requirements – Each Matlab process uses 50 Mb RAM on startup – Memory used increases as more variables are created
• JavaScript and Applets needed for interacting with graphics – Disabling JavaScript removes all graphics interactivity
• Currently limited to Unix/Linux platforms
IPS LAB.
Future Work • Provide ability to upload and download data as well as Matlab code • Provide bulletin board for exchange of ideas, problem discussion, etc. • Develop administrator tools for portal – Make provisions for adding/removing users – Tools for portal administration
• Provide comprehensive documentation for the portal
IPS LAB.
Conclusion • The OSU Matlab Portal has more flexibility than the Matlab Web Server from MathWorks • Possible to create more interactive applications, e.g: zooming into images • Eliminates the need for each user to buy Matlab and all toolboxes • Less expensive alternative since it is based on freely available software/libraries
IPS LAB.
Additional Slides
IPS LAB.
Matlab Display Issues • When run as a background process, Matlab runs in the terminal emulation mode • Problems: – No X-Display available for Matlab – Cannot produce JPEG images directly – Representation of result data severely limited
• Solution: – Use Virtual Network Computing (VNC) – Matlab uses this X display for generating graphics
IPS LAB.
Virtual Network Computing (VNC) • Remote display system • Used to create a virtual desktops • This virtual desktop can be access from a variety of platforms (Unix/Linux, Windows, MacOS) • Has very small memory requirements • Web site: http://www.uk.research.att.com/vnc/
IPS LAB.
Input to Matlab from the Web • All Matlab applications deployed through the portal get input parameters from the user over the web • Names of parameters are specified in deploy.xml • The parameters are returned in the form of a structure paramStruct • All applications have access to this variable in the workspace • Applications must convert parameters from a string to appropriate format IPS LAB.
Example: Accessing input parameters • Consider an application with the following input parameters: – channel : string – start_time: integer – stop_time: integer
• User input over the web: – channel=‘engine_speed’ – start_time=10 – stop_time=40
IPS LAB.
Example (continued) • In Matlab, the parameters can be accessed as: channel_name = paramStruct.channel ; start = str2num ( paramStruct.start_time ) ; end = str2num ( paramStruct.stop_time ) ; • All parameters obtained over the web are available are accessed as strings in Matlab
IPS LAB.
Java Socket used by Matlab • Matlab uses Java sockets for communicating with the Servlet • Data obtained over the web and results to be sent back to the browser are obtained by Matlab using this socket • This socket uses Kerberos for secure communication with the Servlet
IPS LAB.
Sending Results to Browser • Applications are responsible for generating HTML required to display results in the user’s browser • Applications need only create the HTML in the form of a variable named html • This string will be sent back to the user’s browser by the Java socket
IPS LAB.
Generating Images from Matlab plots • Images to be displayed in the browser should be in the JPEG format • The Matlab ‘print’ function is used to print figures to JPEG images • Helper functions are provided for creating filenames, generating JPEG images and creating necessary HTML tags for displaying images
IPS LAB.
Abstract
Presentation
Back to Agenda
Next Abstract
Example: Creating and Displaying Images • Following code illustrates the use of helper function for creating images: y = linspace(-2*pi,2*pi) ; x = exp(y).*cos(y) ; figure ; handle = plot(x,y) ; axis tight ; grid ; file_name = getFileName ; makejpeg (file_name, handle) ; html = addImage ( file_name ) ;
getFileName getFileName::Returns Returnsaarandomly randomly generated generatedfilename filename makejpeg makejpeg::Prints Printsthe thefigure figureto to JPEG JPEGformat format addImage addImage::Creates CreatesHTML HTML
tags tagswith withappropriate appropriatefile filename nameand and path pathto tofile file
IPS LAB.