Hacker News new | ask | show | jobs
by 7thaccount 2250 days ago
Btw...checked out your open source apps. Nice work. I just wish industry was bigger into building their own tools (like was common in the 80s when everyone wrote their own loadflow tools) instead of being reliant upon vendors for everything. There are advantages though to both.
1 comments

My view is that the open source projects for power system simulation available now are approaching a stage where they can perform all of the main functions of commercial tools. In some cases, they even offer functionality that expensive proprietary applications do not have. However, they are typically provided as libraries or with text-based interfaces.

WebAssembly creates an exciting opportunity to combine these libraries with convenient, reactive user interfaces that help to manage the their complexity. The web development community is so large and the frameworks and tools available are of such high quality that an individual, or small team of developers, can quickly create complex applications that would have previously taken much longer. Ultimately, this should accelerate the process of bringing the latest research to industry.

I've been making a similar argument for awhile. With the libraries now available and high level tools (Python, SQL, Numpy...etc) we can build tiny applications (just a few pages of code) that are easy to maintain and do exactly what we need. So replacing the majority of PSSE isn't very hard. An entire EMS system is another game entirely. It's not just the algorithms, but the full integration with SCADA and other things that most companies don't want to get involved with (too much risk).

On a different note, how are you approaching sparse matrices in Octave? Also, I assumed Octave's performance would be a non-starter here for large models. Is it performant enough for you?

Octave includes support for sparse matrices and MATPOWER makes use of them by default. It doesn't require any additional effort from me. In general, Octave can quite match MATLAB for performance, but it is typically not far off. Running it as WebAssembly also comes with a small performance penalty. I haven't run any benchmarks yet, but this can be expected to improve as browser vendors optimize their runtimes.

Octave is using UMFPACK to solve sparse systems of linear equations. There may be some performance to be gained by using KLU with AMD preordering.

I am interested to know how best to compile BLAS and LAPACK to WebAssembly. Traditionally, implementations optimized for a particular machine architecture are used to extract maximum performance. However, WebAssembly targets a stack-based conceptual machine. At present, I use LAPACK v3.4.2 and convert it to C with f2c before compiling to WebAssembly. It would be interesting to perform some benchmark tests against other implementations and compare across browsers.

Neat and thanks for the explanations! When you say running it as Webassembly, is the entire thing compiled that way, or is that just in the front end with Octave running on the server?
The whole application runs on the client (in the browser). The server just serves up static resources. These are cached by the browser so the application will still work if you are offline. The result is much like the desktop applications you mentioned, but without anything needing to be installed.

The JavaScript application presents the UI and controls editing of a JSON representation of the MATPOWER case structure. This data can be seen using the JSON option on the Export page. The WebAssembly program contains GNU Octave and its dependencies. It is run in a WebWorker (background thread) and the JSON data is passed to and fro. The program that converts the JSON into Octave data structures and back again is available here:

https://github.com/rwl/octpower