
SOFTENG 2015 : The First International Conference on Advances and Trends in Software Engineering NumEquaRes — Web Application for Numerical Analysis of Equations Stepan Orlov and Nikolay Shabrov Computer Technologies in Endineering dept. St. Petersburg State Polytechnical University St. Petersburg, Russia Email: [email protected], [email protected] Abstract—A new Web application for numerical simulations, PhasePlane) tool [5] can do that. But what we have learned NumEquaRes, is presented. Its design and architecture are from our examples is that we need certain set of features that motivated and discussed. Key features of NumEquaRes are we could not find in any existing software. These features are the ability to describe data flows in simulations, ease of use, as follows: good data processing performance, and extensibility. Technical challenges specific to Web applications for simulations, related to • ability to explicitly specify how data flows in a simu- performance and security, are discussed. In conclusion, current lation should be organized; results are summarized and future work is outlined. • reasonable computational performance; Keywords–Simulation; Web application; Ordinary differential • ease of use by everyone, at least for certain use cases; equations. • extensibility by everyone who needs a new feature. I. INTRODUCTION The first of these features is very important, but it is missing In this work we present a new Web application, NumE- in all existing tools we tried (see Section VII). It seems quaRes [1] (the name means “Numerical Equation Research”). that developers of these tools and authors of this paper have It is a general tool for numerical simulations available online. different understanding of what a computer simulation can be. Currently, we are targeting small systems of ordinary differen- Common understanding is that the goal of any simulation is to tial equations (ODE) or finite difference equations arising in reproduce the behavior of system being investigated. Numeri- the education process, but that might change in the near future cal simulations therefore most often perform time integration — see Section IX. of equations given by a mathematical model of the system. The reasons for developing yet another simulation software In this paper, we give the term simulation a more general have emerged as follows. Students were given tasks to deduce meaning: it is data processing. Given that meaning, we do not the equations of motions of mechanical systems — for exam- think the term is misused, because time integration of model ple, a disk rolling on the horizontal plane without slip [2], equations often remains the central part of the entire process. or a classical double pendulum [3], — and to try further Importantly, researcher might need to organize the execution investigating these equations. While in some cases such an of that part differently, e.g., run initial value problem many investigation can more or less easily be done with MATLAB, times for different initial states or parameters, do intermediate SciLab, or other existing software, in other cases the situation processing on consecutive system states produced by time is like there is no (freely available) software that would allow integrator, and so on. one to formulate the task for numerical investigation in a Given the above general concept of numerical simulation, straightforward and natural way. our goal is to provide a framework that supports the creation For example, the double pendulum system exhibits quasi- of data processing algorithms in a simple and straightforward periodic or chaotic behavior [3], depending on the initial state. manner, avoiding any coding except to specify model equa- To determine which kind of motion corresponds to certain tions. initial state, one needs the Poincare´ map [4] — the intersection Next sections describe design decisions and technologies of phase trajectory with a hyperplane. Of course, there are chosen for the NumEquaRes system (Section II); simula- ODE solvers in MATLAB that produce phase trajectories. We tion specification (Section III) and workflow semantics (Sec- can obtain these trajectories as piecewise-linear functions and tion IV); performance, extensibility, and ease of use (Sec- then compute intersections with the hyperplane. But what if we tion V); examples of simulations (Section VI); comparison want 104–105 points in the Poincare´ map? How many points with existing tools (Section VII); technical challenges condi- do we need in the phase trajectory? Maybe 107 or more? tioned by system design (Section VIII). Section IX summa- Obviously, the simplest approach described above would be rizes current results and presents a roadmap for future work. waste of resources. A better approach would look at trajectory points one by one, test for intersections with hyperplane, II. DESIGN DECISIONS AND CHOICE OF TECHNOLOGIES and forget points that are no longer needed. But there is no Keeping in mind the primary goals formulated above, we straightforward way to have simulation process like this in started our work. Traditionally, simulation software have been MATLAB. designed as desktop applications or high performance com- Of course, there is software (even free software) that can puting (HPC) applications with desktop front-ends. Nowadays, compute Poincare´ maps. For example, the XPP (X-Window there are strong reasons to consider Web applications instead Copyright (c) IARIA, 2015. ISBN: 978-1-61208-449-7 41 SOFTENG 2015 : The First International Conference on Advances and Trends in Software Engineering of desktop ones, because on the one hand, main limitations simulation is a data processing system defined by a scheme for doing so in the past are now vanishing, and, on the other consisting of boxes (filters) with input ports and output ports hand, there are many well-known advantages of Web apps. For that can be connected by links (pipes). Output ports may have example, our “ease of use” goal benefits if we have a Web app, many connections; input ports are allowed to have at most because this means “no need for user to install any additional one connection. Simulation data travels from output ports to software”. input ports along the links, and from input ports to output Thus we have decided that our software has to be a Web ports inside boxes. Inside each box, the data undergoes certain application, available directly in user’s Web browser. transformation determined by the box type. Now, the “extensibility by everyone” goal means that our Typically boxes have input and output ports, so they are project must be free software, so the GNU Affero GPL v3 data transformers. Boxes without input ports are data sources, license has been chosen. That should enforce the usefulness and boxes without output ports are data storage. of software for anyone who could potentially extend it. Simulation data is considered to be a sequence of frames. The “Reasonable performance” goal has determined the Each frame can consist of a scalar real value or one- choice of programming language for software core compo- dimensional or multi-dimensional array of scalar real values. nents. Preliminary measurements have shown that for a typical The list of sizes of that array in all its dimensions is called simulation, native code compiled from C++ runs approx. frame format. For example, format f1g describes frames of 100 times faster than similar code in MATLAB, SciLab, or scalar values, and format f500,400g describes frames of two- JavaScript (as of JavaScript, we tested QtScript from Qt4; with dimensional arrays, each having size 500 × 400. The format other implementations, results might be different). Therefore, of each port is assumed to be fixed during simulation. we decided that the simulation core has to be written in C++. Links between box ports are logical data channels, they The core is a console application that runs on the server cannot modify data frames in any way. This means that data and interacts with the outer world through its command line format has to be the same at ports connected by a link. Some parameters and standard input and output streams. It can also ports define data format, while some do not; instead, such a generate files (e.g., text or images). port takes format of port connected with it by a link. Thus, JavaScript has been chosen as the language for simulation data format propagates along links. Furthermore, data format description and controlling the core application. However, this can also propagate through boxes. This allows to provide quite does not mean that any part of running simulation is executing flexible design to fit the demands of various simulations. JavaScript code. The decision to use the Qt library has been made, because IV. SIMULATION WORKFLOW it provides a rich set of platform-independent abstractions for working with operating system resources, and also because it This section explains how simulation runs, i.e., how the supports JavaScript (QtScript) out of the box. core application processes data frames generated by boxes. Other parts of the applications are the Web server, the Further, the main routine that controls the data processing database engine, and components running on the client side. is called runner. For the server, we preferred Node.js over other technologies because we believe its design is really suitable for Web A. Activation notifications applications — first of all, due to the asynchronous request processing. For example, it is easy to use HTML5 Server When a box generates a data frame and sends it to an Sent Events [6] with Node.js, which is not the case with output port, it actually does two things: LAMP/WAMP [7]. • makes the new data frame available in its output port; The MongoDB database engine has been picked among others, because, on the one hand, its concept of storing JSON- • activates all links connected to the output port. This like documents in collections is suitable for us, and, on the step can also be called output port activation.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages7 Page
-
File Size-