To see this in action, please check out to energysim.kooma.net. For a bit more academic background on this, please see this blog post.
First you'll need to build the project. This will generate all of the javascript that is required.
sbt generateJs
Due to browser's loading policies you will need to start a static-file
web server in the site
directory. I have not bothered setting this
up in SBT and have just used python3's in-built HTTP server module:
cd site; python3 -m http.server 8000
After this go to http://localhost:8000
.
You can also run the command line simulator through SBT like this
(also try --help
):
sbt 'libraryJVM/run -r 1000 world.yml'
This is a ScalaJS project for a single-page application runnable in modern browsers that implements a monte carlo simulation modeling the electricity market (production, consumption, transmission, imports) of Finland. The project is structured into four separate SBT projects:
-
library
that is a ScalaJS cross-project, meaning its targets are split intolibraryJVM
(JVM-targeted version) andlibraryJS
(JavaScript-targeted version). Sources for these are located inlibrary/shared
andlibrary/jvm
subdirectories (there is no JS-specific code in library). -
worker
, a JS-only project that uses the simulator core from library and wraps it into a web worker. The source code for this is inworker
subdirectory. -
ui
that contains the actual user interface that runs in the browser, and code is in theui
subdirectory.
The UI component is not stand-alone, but requires some scaffolding
(HTML, CSS and external resources) that is in the site
subdirectory.
See the TODO.md
file. There are tons of things I have not gotten
around to do.
Copyright 2017 Santeri Paavolainen.
This work is licensed under Apache 2.0 License, see LICENSE
file for
details.