# Simulations

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FeY0lOaFHM13kNM7xTxK1%2Fimage.png?alt=media&#x26;token=2549fa69-7696-4370-81d8-bac44a13ec2e" alt=""><figcaption></figcaption></figure>

Once you've created your first simulation, you'll be directed to the **simulation page** - here you can see the simulation results and control all aspects of the simulation.

A simulation is a 2D rectangular region containing a number of **objects** and **sources**. When the simulation is running, WiFi waves are emitted from sources, and move around the simulation. When waves encounter an object, they are reflected, refracted and absorbed realistically. When waves reach the edge of the simulation domain, they leave and don't return.

### Control panes

The various floating windows contain different controls for the simulation. They can be moved around and minimised, after which they will appear in the lower-left corner of the screen:

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FXOL4TnjfzWKj78i9OOhy%2Fimage.png?alt=media&#x26;token=9a139947-5b47-4177-aaba-4a22b2c75c47" alt=""><figcaption></figcaption></figure>

### Navigation

Move around the simulation like you would in Google Maps:

* Click and drag to move around the simulation.
* Scroll to zoom in and out (or pinch if using a mobile device)
* To disable interactions with objects, choose the **Move** option from the options in the navigation bar

### Simulation controls

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FVh8BRBllSwTJ34FE5ZZe%2Fimage.png?alt=media&#x26;token=d05a5c96-f60a-46d2-be63-3267971fc6be" alt=""><figcaption></figcaption></figure>

Here you can control the execution of the simulation, and the underlying parameters that control it.

#### Automatic speed

Select this option if you want the simulation to run at a comfortable frame rate for easy viewing. Choose the desired frame rate, and the simulation will adjust its speed automatically.

**Manual speed**

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FOJyMJPxW5FtL2RB3KgDZ%2Fimage.png?alt=media&#x26;token=e87d5004-1485-4cbc-a8f0-5ebdfeb9e485" alt=""><figcaption><p>The manual simulation speed options</p></figcaption></figure>

Select this option if you need more control over exactly how a simulation is executed:

* **Time step** - this setting controls the actual time step that the simulation uses. Larger steps speed up the simulation, but may result in numerical instability.
* **Render every** - this setting controls how many simulation steps are performed before the UI is updated. Increasing this setting may improve simulation speed if your device struggles to render the simulation quickly.

#### Simulation parameters

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FEAZT86us2ZJZEOMPb1ii%2Fimage.png?alt=media&#x26;token=ff25359f-45c5-46a5-b10b-5dadb82137c7" alt=""><figcaption><p>The simulation parameters appear in a new control pane</p></figcaption></figure>

The settings here control how the simulation is actually constructed - changing any of them will require restarting the simulation.

* **Nx/Ny** - the number of simulation grid cells in the x/y directions. Increasing these values allows simulating a larger area, but at the cost of increased simulation times.
* **Grid size** - the physical size of each grid cell. If this size is too large, the simulation may become unstable. A good rule of thumb is that it is smaller than 10% of the wavelength.
* **Wavelength** - this is the wavelength of radiation that sources emit. The smaller this value, the smaller the grid size will need to be to maintain stability.

### Visualisation controls

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2Ff46BSzsWAWvndooHOlpY%2Fimage.png?alt=media&#x26;token=23fef805-f3e4-4e8e-83db-bc4f6739c116" alt=""><figcaption><p>Visualisation controls</p></figcaption></figure>

The controls here affect how the simulation results are visualised, and don't affect the simulation itself.

* **Signal** - choose **EM field** to show the current amplitude of the electromagnetic field - this setting may result in a lot of flickering if the simulation is running rapidly. Choose **Power** to show the time-averaged radiation power - this setting results in a much smoother visualisation.
* **Objects** - chose **Outline** to show object outlines, **Index** to show objects filled-in, and **None** to hide objects.
* **2D/3D** - switch between 2D and 3D visualisation modes. Objects and sources can only be edited in 2D mode, but 3D mode can be helpful when understanding the results of the simulation.
* **Colormap** - choose one of many colormaps to visualise the Signal you have chosen.
* **Colormap scale** - set the limits of the colormap to expose or reduce detail.

### Selection controls

When no objects or sources are selected, you'll see the options to add an object/source, or export an image of the simulation:

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FPM7NnBjIGbbNh0IFAdT4%2Fimage.png?alt=media&#x26;token=c68343bc-50ab-41d3-bf91-28bf59fe5286" alt=""><figcaption><p>The selection controls with nothing selected.</p></figcaption></figure>

* **Save image** - the current contents of the simulation will be saved as a PNG file to your device.
* **Add object** - add a new object or source to the simulation.

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2F2QDVI5Db5vDUnnzw8iaG%2Fimage.png?alt=media&#x26;token=dc5014d7-432c-4b70-9f89-69e1d5dc393c" alt=""><figcaption><p>The selection controls with an object selected</p></figcaption></figure>

When an object is selected, you'll be able to finely adjust its properties, copy it, or delete it.

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2F4xFQzIa4wRCzKf8oHFfd%2Fimage.png?alt=media&#x26;token=00b66cd8-11f7-4066-89bd-7bb540446f4a" alt=""><figcaption></figcaption></figure>

When a source is selected, you can finely adjust its position and relative strength.

### Adding objects

WiFi Solver supports several different object types in simulations:

* **Rectangles** - a rectangular region of constant material.
* **Circles** - a circular region of constant material.
* **Images** - a bitmap whose colour determines the material (see below).
* **Sources** - a WiFi source - up to 4 sources can be added to a simulation.

#### Materials

Choosing a material for an object changes how it refracts and absorbs WiFi waves. Several common house materials are pre-defined with the appropriate values for WiFi signals.

#### Images

When uploading an image, the following colours are converted to the corresponding material. All other colours are matched to the closest material:

* **Red** - `rgb(255, 0, 0)` - wood
* **Green** - `rgb(0, 255, 0)` - glass
* **Blue** - `rgb(0, 0, 255)` - brick
* **White** - `rgb(255,255,255)` - concrete

An example image that is safe to use in a simulation looks like this:

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FqQ5YnILk4HQFvxbN0rQc%2Fhouse-01-01.png?alt=media&#x26;token=4c02f2e4-cc0b-437f-89a8-fe5f451b3577" alt=""><figcaption><p>An example image for a simulation. Why not trythis one?</p></figcaption></figure>

### Adding probes

Probes are points in space that record signal strength along horizontal and vertical axes. Use probes to compare signals at different points or times:

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FOyhRXPZwSqQKtO5sgK5x%2Fimage.png?alt=media&#x26;token=896acce5-5191-4fb0-a3c2-960bd43af7b6" alt=""><figcaption><p>When at least one probe is added, the 'Probes' pane is available.</p></figcaption></figure>

To add a probe, select **Probe** from the **Add objec**t menu in the **Selection** pane. The available options for customising probes are:

* **Name** - the displayed name of the probe
* **Live** / **Static** - whether the probe updates when the simulation is running. Leave a probe set to **Static** if you want to compare the simulation at two different times.
* **Radius** - how many adjacent simulation grid cells are averaged over to compute the probe value. Increase this value if you want smoother results.
* **Color** - the displayed color of the probe in the simulation viewport, and the **Probes** pane.

Probes record average power flux, normalised to the strongest source in the simulation. Placing a probe directly on the strongest source would yield a value of 0 dB.

### Saving changes

Changes are saved automatically as you make them. See when your changes were last saved from the menu in the navigation bar:

<figure><img src="https://58776923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrRIf4SV3WFkabUWKslD7%2Fuploads%2FyMtvgQ8FmrVupoVLvrE0%2Fimage.png?alt=media&#x26;token=f6f181b9-3c58-4bcd-ba98-355523009825" alt=""><figcaption></figcaption></figure>
