Difference between revisions of "WebKit Users Guide"
| Line 82: | Line 82: | ||
==== Creating new initial configurations in CGOL ==== | ==== Creating new initial configurations in CGOL ==== | ||
This CGOL simulation uses a Cell Matrix with black/white respectively representing dead/alive. To alter the initial configuration, press or click the left mouse button on any black or white cell to toggle that cell to the opposite color. If you press the mouse button, you can drag the mouse to change dragged-over cells to the new color. | This CGOL simulation uses a Cell Matrix with black/white respectively representing dead/alive. To alter the initial configuration, '''press''' or '''click''' the left mouse button on any black or white cell to toggle that cell to the opposite color. If you press the mouse button, you can '''drag''' the mouse to change dragged-over cells to the new color. | ||
When done, click the '''Reset''' button once; clicking '''Run''' will execute the simulation with the new configuration, and single clicks on '''Reset''' will restore your initial configuration. Double-clicking '''Reset''' restores factory settings. | When done, click the '''Reset''' button once; clicking '''Run''' will execute the simulation with the new configuration, and single clicks on '''Reset''' will restore your initial configuration. Double-clicking '''Reset''' restores factory settings. | ||
Revision as of 15:48, 2 July 2025
Numerus WebKit (NWK) is a technology for building powerful simulations that run in a Web browser. It consists of applications and APIs that support the design of models along the lines of NetLogo (NL) and Stella, but using conventional languages such as Java, JavaScript (JS) and Python.[1] These applications are deployed either from a remote server, such as Amazon Web Services (AWS) Elastic Beanstalk (AWSEB), (or, in Java mode, any other server that supports WebSockets, or in JS mode, from any conventional Web or Cloud server); alternatively, they can be run locally without using any network connectivity using a localhost server. JS development only requires text editing, and Java development can take advantage of the Eclipse J2EE (Jakarta) platform using the Apache Tomcat server.
This Guide will introduce the NWK user interface (UI) and the many useful functions that enhance and support the user's experience. A separate document, the WebKit Authors Guide, is under development.
Nomenclature
- Model
- A system that is initialized parametrically to an start state and is sequentially clocked to produce a new state and output vector on each clock strobe. NWK supports System Dynamic (SD), Spatial and Individual-based (IB) models. Models in NWK are currently implemented either in Javascript or Java.
- Simulation
- A model in execution. Simulations are managed from the UI.
- Project
- A single unit deploying 1 or more simulations, usually employing a single Web page. Projects are specified using a project file, containing JSON code detailing the UI and at least providing parameters for the model. Small SD models may be specified in the project file.
- "Factory Settings"
- Projects are delivered with parameters and settings determined by the author. Users may change parameters and override some setting, however factory settings can always be recovered.
- "The Drawer"
- The NWK screen has a sliding partition on the right-hand side, controlled by the user, that reveals documentation and other features detailed below when slid leftward.
- Presets
- NWK provides a storage facility to record and recall various choices for settings and parameters. The presets are like "radio buttons" selecting various alternative sets of configurations.
- RAMs
- RAMs (Runtime alterable modules) allow the author to provide the means for selecting sets of alternative algorithms used by the model. Authors may also use the RAM facility to enable a user to completely specify some model (these are called UberRAMs, or URAMs).
- "numml"
- numml (Numerus Modeling Language) is a small, simple, domain-specific language (dsl) that serves 2 functions: 1) to specify the algorithm or model in RAMs and URAMs; and 2) to assert configuration changes to factory settings.
- Analysis Platforms
- These are special tabs used in some projects to enable such facilities as sensitivity analysis, curve fitting, MCMC, etc.
- CSV
- This refers to the option of saving data from a graph to a comma separated list.
Platform Overview
This image shows the browser window running the sample individual-based project "Rock Paper Scissors". The features are all described later in this guide.
- Model Inputs
- These sliders set parameters for the simulation. Changes are forwarded even while the simulation is running and may have immediate effect.
- Timers
- These windows show the current model time. The left window counts up from 0. If the simulation is designed to run for a fixed time period, the right timer window will be initialized to that time and will count down.
- Operating Buttons
- The Connect/Disconnect buttons activate/deactivate the connection between the UI and the model logic. Disconnecting and Connecting is one way to restart the application; reloading the page is another.
- The Reset, Step and Start/Stop buttons operate the simulation. Step executes a single time step, Start/Stop bring about continuous operation, and Reset restores the initial state and resets the timers. Double-clicking Reset also reinitializes the application.
- Speed Control
- This determines the real-time interval between steps.
- Displays
- A spatial or agent-based simulation will include a "SimWorld" display that uses graphic cues to show the current state of the model. Among these cues are location and color, for both cells and agents, and, additionally, size and shape for agents.
- Other displays such as Spys (showing a single current value) graphs, tables, etc. are specified in the Project file (see below).
- Side Panel
- The browser page has a side panel contained in a "drawer". Use
to toggle it open and closed, or pull on the lavender bar to adjust its location. The drawer contains model documentation, the preset display, a configuration window, and a log window for status reports. If the project uses RAMs the side panel will be wider and will contain access to RAM controls.
- System Dynamics
- The third image shows the sample SD Lotka-Volterra project. An SD project will display the current choices for dt and integration method (Euler or RK4). These can be overridden from factory settings using the configuration window.
WebKit Tutorial
In this section we introduce the platform's features with illustrations using one or more of the sample projects in the model library. The full model library can be found in the WebKit Examples document. Note that we will be looking at the Javascript model implementation only at this time, as some of the features described here are only available with this implementation.
Among the topics covered are:
- User initialization of spatial and agent-based models
- Presets
- numml language
- RAMS and URAMS
- Configuration overrides
- Analysis platforms
- Downloading CSVs
Model Initialization and Using Presets with Conway's Game of Life and Agents1
Conway's Game of Life (CGOL) uses a 128 x 128 board with solid edge and an initial configuration consisting of the "R-pentomino". (Try it!) CGOL's model operates on a cellular automaton with 2 possible states, dead and alive.
Agents is a very simple simulation of agents of different sizes and shapes. The space in which they are moving has elastic walls off of which the agents bounce. They also behave like an ideal gas with respect to their physical interaction. (This behavior was a choice made by the project's author.) Agents (1) has the same model, only initially empty.
With NWK you can:
- Click and drag to create new initial configurations;
- Save your configuration in the Presets.
Creating new initial configurations in CGOL
This CGOL simulation uses a Cell Matrix with black/white respectively representing dead/alive. To alter the initial configuration, press or click the left mouse button on any black or white cell to toggle that cell to the opposite color. If you press the mouse button, you can drag the mouse to change dragged-over cells to the new color.
When done, click the Reset button once; clicking Run will execute the simulation with the new configuration, and single clicks on Reset will restore your initial configuration. Double-clicking Reset restores factory settings.
Creating new initial configurations in Agents (1)
You add agents to Agents (1)'s landscape in a similar manner.
Preset Basics
The Preset feature provides a quick way to save and restore a configuration, modeled on the "radio buttons" found in cars. The Preset control consists of 13 such preset buttons. Each preset label is either red or green, respectively, depending on whether or not the preset is currently assigned to a configuration. Selecting a "green" label will restore the configuration saved in that preset. Selecting a red label has no effect on the configuration.
Note that preset 0 is permanently bound to factory settings and cannot be changed.
Tags. Each preset can be optionally given a tag; i.e., a label used to identify the settings for that preset. Simply enter the tag in the Tag text field before saving the preset.
Preset and tag selection are also controlled from the main control panel, making it unnecessary to have the drawer open while shifting between different presets. The Preset control is located to the right of the Speed slider, and rotates through the available presets as it is clicked up or down. Tagged presets display their tag when selected.
Configurations are saved and cleared using the Save/Clear/Cl All buttons to the right of the Preset controls. Whichever preset is selected will be affected by Save/Clear; Cl All will delete all presets (except for preset 0).
Presets are stored in the Web browser and will be there when you return to the project. A local JSON file storing the complete current bank of presets is created using the Preset ↔ Local File controls found to the left of the Configuration window. Use stored presets as a backup, for transferring between browsers, and when you exceed the 12 user preset limit.
Something to try
Create a set of CGOL initial configurations using the mouse as described and store them in presets. Test the presets by restoring the configurations. Practice using Save and Clear until you are comfortable with building configurations and storing/restoring them using the presets.
One more thing about Presets
Some projects include ready-made presets. These will be installed the first time you access the project. You may make changes to and save ready made presets. You can restore the factory set of ready-mades by deleting all presets and reloading the project.
- ↑ This API is under development.


