Adding Interactive Human Interface to Engineering Software
Total Page:16
File Type:pdf, Size:1020Kb
Ph.D. Dissertation Adding Interactive Human Interface to Engineering Software Gonzalo Alberto Farias Castro Computer Scientist Departamento de Inform´atica y Autom´atica Escuela T´ecnica Superior de Ingenier´ıa Inform´atica Universidad Nacional de Educaci´on a Distancia Madrid, 2010 Department Informatica´ y Automatica´ E.T.S. de Ingenier´ıa Informatica´ Title Adding Interactive Human Interface to Engineering Software Author Gonzalo Alberto Farias Castro Degree Computer Scientist Facultad de Ingenier´ıa, Ciencias y Administracion´ Universidad de la Frontera Supervisors Sebastian´ Dormido Bencomo Francisco Esquembre Mart´ınez To my family... Acknowledgements I wish to thank all those who, in different ways, have contributed to the completion of this thesis: • To my supervisors Sebasti´an Dormido Bencomo and Francisco Esquembre Mart´ınez, who have supported me during all these years. I have tried to apply your con- structive comments and invaluable guidance to complete this work. Sebasti´an and Paco, thank you so much for your opinions and suggestions, which have helped me to grow personally and professionally. I can honestly say that I feel extremely lucky to have worked with you. • To professors Karl-Erik Arz´˚ en and Anton Cervin, who have given me the oppor- tunity to work for three months at the Automatic Control department of Lund University. This was a great experience for me, and I tried to do my best to take advantage of your work in order to improve this thesis. Thanks also to all the people in the department who helped me during my stay in the rainy and beauti- ful green city of Lund. I also would like to thank Karl-Erik to have given me the chance to be a Malm¨o FF supporter, which was a very gratifying experience. • To professor Robin De Keyser, who always gave me his support during my time spent at the EeSA Department of Ghent University and also throughout the de- velopment of this thesis. Professor, thank you for your successful and positive suggestions. Special thanks also to everyone I met at the UGent: Syafie, Jorge, Luis Alfonso, Clara, Susana, Stefan, Mirabela, Cosmin, Radu, Iounut, and Andr´e De Cokere. • To the people of the DIA Department at the UNED. Thank you very much for your help and support during all these years. Special thanks to Pilar for all the help given with administrative issues. Similarly, I wish to thank professors Mar´ıa Antonia Canto, Joaqu´ın Aranda, Fernando Morilla, Jos´e Luis Fern´andez Marr´on, Raquel Dormido, Natividad Duro, Alfonso Urqu´ıa, and Jos´eManuelD´ıaz. • To my colleagues and friends of the DIA Department at the UNED. Thanks Roc´ıo, Carla, Carlos, Arnoldo, Dictino, Victor, Miguel Angel, David, Mar´ıa, Luis, Ale- jandro, Jes´us, Oscar and Ernesto. Thank you everyone for these really enjoyable moments that we have shared these years, especially during coffee breaks! Special thanks to my Chilean friends and partners H´ector and Claudia for their constant support and friendship during our stay in Spain. We have been very lucky to coincide here in Spain after finishing university in Chile. • To professors Sebasti´an Dormido Canto and Jos´eS´anchez Moreno for their friend- ship and help. Thank you very much for your professional and personal sugges- tions. Sebas, thank you very much for your insistence in getting a scholarship. • To the people of the DACYA Department at UCM. Special thanks to professors Matilde Santos and Jes´us Manuel de la Cruz, for helping me on my arrival to the UCM. I would like to thank also my dear professor Matilde for her friendship. • To the people of the CIEMAT, especially Jes´us Vega for giving me the opportunity to collaborate and obtain good publications during these years. • To my friends here in Madrid, Danilo, Desy and Estela, who have always made me feel as if at home in Chile. • To my dear friend Elizabeth, who started this adventure in Spain with me. Eli, I will always owe you. I hope to have the opportunity to give back at least a small part that you gave me. Eli, people like you make this world a better place. • To all my family, especially my mother Emelina, my sister Nitcy, my wife Ruth, and my aunts Cecilia and Teresa, for their unconditional support and love. Thank you for never reproaching me all the time that I have not been with you. Tuty this thesis would never have been possible without you. • To Spain and its people for the financial support obtained for this thesis. Spain, as Neruda said, it will be always in my heart. • Finally, to God who looks after my family and friends. Contents Acknowledgements ii List of Tables x List of Figures xii 1 Introduction 1 1.1Objectives................................... 6 1.2PhDthesisoutline.............................. 7 1.3Maincontributions.............................. 10 1.3.1 Softwarecomponentsdeveloped................... 10 1.3.2 Publications.............................. 11 1.3.3 Researchprojects........................... 14 2 Design of Interactive Interfaces for Engineering Education 17 2.1Simulationswithstandardengineeringtools................ 19 2.1.1 Theimportanceofinteractivityandvisualization......... 23 2.2Theinteroperateapproach.......................... 26 2.2.1 Addinginteractivityandvisualization............... 28 2.3Definingacommunicationprotocol..................... 29 2.3.1 TheJavalanguage.......................... 31 2.3.2 Low-levelprotocol.......................... 32 2.3.3 Sampleuseofthelow-levelprotocol................ 35 2.3.4 High-levelprotocol.......................... 37 2.3.5 Sampleuseofthehigh-levelprotocol................ 39 2.3.6 Loworhighlevelprotocol?..................... 41 v 2.4Remoteinteractionofengineeringsoftware................. 42 2.4.1 Remotelink.............................. 42 2.4.2 Synchronousremotelink....................... 45 2.4.3 Asynchronousremotelink...................... 46 2.4.4 Synchronousorasynchronouslink?................. 49 2.5Advantagesoftheinteroperateapproach.................. 49 2.6Conclusions.................................. 50 3 Implementing the Interoperate Approach 53 3.1InterfacingMATLABwithstandardlanguages.............. 53 3.1.1 Calling MATLAB from C . ................... 55 3.1.2 Calling C routines from Java . ................... 57 3.1.3 Calling MATLAB from Java . ................... 59 3.2 An implementation of ExternalApp forMATLAB............ 62 3.2.1 The MatlabExternalApp Javaclass................ 63 3.2.2 Using the class MatlabExternalApp from a Java program . 67 3.3InterfacingSimulinkmodelswithJava................... 69 3.3.1 Controlling Simulink simulations from MATLAB ......... 72 3.3.2 Controlling a modified Simulink model from Java ......... 74 3.3.3 General process to simulate Simulink models from Java . 77 3.3.4 Specificmodificationsforintegratorblocks............. 77 3.3.5 Anexampleofadynamicsystem.................. 81 3.3.6 Speedingupthesimulations..................... 85 3.4 A direct implementation of ExternalApp forSimulink.......... 86 3.4.1 The Java class SimulinkExternalApp ............... 86 3.4.2 Using the class SimulinkExternalApp from a Java program . 93 3.5RemoteinterfacingMATLABandSimulinkwithJava.......... 95 3.5.1 ThesoftwareJIMserver....................... 95 3.5.2 Implementation of the communication protocol for remote links . 100 3.5.3 ThepackageJIMC.......................... 110 3.6InterfacingotherengineeringsoftwarewithJava.............. 111 3.6.1 Scilab................................. 112 3.6.2 Sysquake............................... 114 3.7Conclusions.................................. 117 4 Interactive Applications Using Engineering Software 119 4.1EasyJavaSimulations:EJS......................... 120 4.1.1 AfirstexamplewithEJS:evaluationofafunction........ 123 4.1.2 AsecondexamplewithEJS:manipulatingODEs......... 125 4.2UsingtheJIMCpackagefromEJS..................... 128 4.2.1 Using the MatlabExternalApp JavaclassfromEJS........ 129 4.2.2 Using the RMatlabExternalApp JavaclassfromEJS....... 131 4.2.3 Using the SimulinkExternalApp JavaclassfromEJS...... 132 4.2.4 Using the RSimulinkExternalApp JavaclassfromEJS..... 133 4.3 A built-in implementation of the ExternalApp inEJS.......... 135 4.3.1 Abuilt-infeaturetoconnectMATLABwithEJS......... 136 4.3.2 A built-in feature to connect a remote MATLAB with EJS . 138 4.3.3 A built-in feature to connect Sysquake and Scilab with EJS . 138 4.3.4 Abuilt-infeaturetoconnectSimulinkwithEJS......... 139 4.3.5 Abuilt-infeaturetoconnectaremoteSimulinkwithEJS.... 141 4.3.6 Otherbuilt-infeaturesinEJS.................... 142 4.4BuildingremotelaboratorieswithMATLABandEJS.......... 144 4.4.1 Typesofremotelabs......................... 145 4.4.2 Commonaspectsofimplementingremotelabs........... 146 4.4.3 Networkedcontrollabimplemented................ 150 4.4.4 Computingthecontrolsignal.................... 151 4.4.5 Modeloftheremoteservomotor.................. 151 4.4.6 Controlaspectsoftheremoteservomotor............. 153 4.4.7 Graphicaluserinterfaceofthenetworkedcontrollab....... 158 4.4.8 Usingandevaluatingthenetworkedcontrollab.......... 160 4.5Conclusions.................................. 161 5 Virtual Laboratories of Embedded Control Systems 163 5.1Embeddedcontrolsystems.......................... 165 5.1.1 Parametersofareal-timetask................... 165 5.1.2 Schedulingpolicies.......................... 166 5.1.3 Codesignproblem.......................... 168 5.2TrueTime................................... 169 5.3VirtualLabsUsingTrueTime........................ 171 5.3.1 ConnectionProcess......................... 172 5.3.2 Improvingperformance......................