Skip to content

Commit

Permalink
Update from internal repository
Browse files Browse the repository at this point in the history
  • Loading branch information
kschrab committed Oct 31, 2024
1 parent 05bf9a1 commit 67d8a17
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 37 deletions.
26 changes: 16 additions & 10 deletions content/docs/extending_mosaic/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You have to install the [same requirements](/docs/getting_started/#additional-so

### Get the code

Please find the MOSAIC code in the Github repository [here](https://github.com/eclipse/mosaic). Let's say you would like to contribute your changes, so you fork the repository first, and read [guideline how to contribute](https://github.com/eclipse/mosaic/blob/main/CONTRIBUTING.md).
Please find the MOSAIC code in the GitHub repository [here](https://github.com/eclipse/mosaic). Let's say you would like to contribute your changes, so you fork the repository first, and read [guideline how to contribute](https://github.com/eclipse/mosaic/blob/main/CONTRIBUTING.md).

```bash
git clone [email protected]:<github-username>/mosaic.git eclipse-mosaic
Expand All @@ -37,18 +37,17 @@ mvn clean install
The entry class `MosaicStarter` has a lot of dependencies which need to be referenced during startup, so we recommend that you use the package functionality of maven and then run the bundle. Everything else would be overly complicated. Also, we don't build "fat jars" so you won't be able to run any jar directly. The following is almost the same procedure as presented in the non-developer guides, just that you build the bundle locally.

- Run `mvn clean install`
- Unzip one of the `bundle/target/eclipse-mosaic-24.1-SNAPSHOT.*` archives to a destination of your choice
- Unzip one of the `bundle/target/eclipse-mosaic-{{< version of="mosaic_snapshot" >}}.zip/tar` archives to a destination of your choice
- Run the `mosaic.sh/bat` files, which will do all the magic for you (have a look inside if you ask yourself if there's a more direct way to start from console).

### Use IntelliJ IDEA

- Start IntelliJ IDEA and choose `Open or Import` (see figure 1).
- Start IntelliJ IDEA and choose `Open or Import` (see Figure 1).
- Choose the cloned `eclipse-mosaic` repository
- For IntelliJ there's already a [pre-defined run configuration](https://github.com/eclipse/mosaic/blob/main/rti/mosaic-starter/MosaicStarter.run.xml) in the repo which should work right away when you run it (see figure 2).
- For IntelliJ there's already a [pre-defined run configuration](https://github.com/eclipse/mosaic/blob/main/rti/mosaic-starter/MosaicStarter.run.xml) in the repo which should work right away when you run it (see Figure 2).

Good to know:
- When changing any pom.xml you need to: `Rightclick on root-module > Maven > Reload project`
- When making changes to `runtime.json | logback.xml | hosts.json` you need to re-run `mvn validate`, in order to copy them into the target folder.
- When changing any `pom.xml` you need to: `Rightclick on root-module > Maven > Reload project`

{{< figure src="images/open-project.png" title="Open the project" numbered="true" width="300">}}
{{< figure src="images/run.png" title="Run MosaicStarter" numbered="true" width="400" >}}
Expand All @@ -57,8 +56,15 @@ Good to know:

Given that you execute the code from source, some important file locations change:

| Bundled | From Source |
| :------------- | :------------- |
| Bundled | From Source |
|:--------------------------|:--------------------------------------------------------|
| `<mosaic-root>/scenarios` | `<mosaic-root>/bundle/src/assembly/resources/scenarios` |
| `<mosaic-root>/etc` | `<mosaic-root>/rti/mosaic-starter/target/classes/etc` |
| `<mosaic-root>/logs` | `<mosaic-root>/rti/mosaic-starter/logs` |
| `<mosaic-root>/etc` | `<mosaic-root>/rti/mosaic-starter/etc` |
| `<mosaic-root>/logs` | `<mosaic-root>/rti/mosaic-starter/logs` |

### Combine Mosaic (Windows IntelliJ IDE) with ns3 (WSL)

- In your WSL environment, download the `eclipse-mosaic-{{< version of="mosaic_snapshot" >}}.zip/tar` and install ns-3 and federate (
using `ns3_installer.sh`).
- Copy the resulting `bin` folder (with the fully compiled ns3) into the `eclipse-mosaic/rti/mosaic-starter` folder
- Now it should behave as if you run everything from WSL
58 changes: 35 additions & 23 deletions content/docs/simulators/network_simulator_ns3.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,30 @@ prepared an installation script, which manages most of the required work.

### Prerequisites

For GNU/Linux platforms, the minimal requirements to run basic simulations are a **gcc** or **clang** compiler
and a **Python** interpreter. At least you need the following packages to be installed:
For **ns3** on GNU/Linux platforms, the requirements to run basic simulations are a gcc or clang compiler and a Python interpreter.
For a complete list of required packages for different distributions, please refer to the ns-3 installation guide:
{{< target-blank "https://www.nsnam.org/wiki/Installation" "https://www.nsnam.org/wiki/Installation" >}}.
You most probably need the following packages to be installed:

***Minimum requirement:***
```plaintext
gcc
g++
cmake
python3
gcc
g++
cmake
python3
python3-dev
```

For a complete list of required packages for different distributions, please refer to the ns-3 installation
guide: {{< target-blank "https://www.nsnam.org/wiki/Installation" "https://www.nsnam.org/wiki/Installation" >}}
For the **ns3 installation script**
please make sure the following programs and libraries are installed:

Please make also sure the following libraries are installed before running the installation script:
* libxml2
* libsqlite3
* libprotobuf {{< version of="ns3_protobuf" >}}
```plaintext
protobuf-compiler
libxml2-dev
libsqlite3-dev
libprotobuf-dev>={{< version of="ns3_protobuf" >}}
```

Watch out that the protobuf-compiler and libprotobuf-dev versions have to match.

### Run the installation script

Expand All @@ -69,12 +74,6 @@ need to ensure, that all required libraries are present on your system before pr
may need superuser permissions to install packages.
{{% /alert %}}

{{% alert note %}}
If your local ClientServerChannel protocol version (protobuf files) does not fit the required one, the installation
may fail with an error. In that case, you can run the install script with the `-p` flag. This will
rebuild the protobuf files during installation and allow it to proceed correctly.
{{% /alert %}}

To ease the installation of ns-3 for Eclipse MOSAIC, the installation process has been delegated to an installation
script, called `ns3_installer.sh` that can be found in the associated ns-3 federate folder.

Expand All @@ -91,17 +90,29 @@ script, called `ns3_installer.sh` that can be found in the associated ns-3 feder
3. Apply a patch to ns-3 in order to make it work with Eclipse MOSAIC.
4. Add the ns-3 federate to the waf build system.
5. Configure and build the patched ns-3 with the ns-3 federate.
(Watch out that premake will throw `fatal error: ns3/application.h: No such file or directory` but the installation is successful
anyways.)

**In order to start the simulation, the following steps need to be performed:**
1. Set up the `ns3_federate_config.xml`-file in the scenario folder (see section [Configuration](/docs/simulators/network_simulator_ns3#configuration)). An example `ns3_federate_config.xml` - file is shipped with the Tiergarten scenario.
2. At last ns-3 has to be activated in the `mosaic_config.xml` and the simulation can be started.
2. Don't forget to enable ns-3 in the `scenario_config.json` of your specific scenario, and the simulation can be started.


{{% alert note %}}
Using the installer script will reinstall (rebuild) ns-3 and the federate because it is designed for a user environment and not for federate development.
Read [here](/docs/extending_mosaic/ns3_setup) for futher information on how to set up a development environment for the ns-3 federate
{{% /alert %}}

### Use NS-3 federate on Windows with WSL

WSL, or "Windows Subsystem for Linux", provides an environment for Windows users to run Linux based applications. With WSL, it is possible
to use the ns-3 federate, which is currently only compatible with Linux systems, in a Windows environment.

- If not yet done, setup a WSL environment with a Ubuntu distribution. This environment must be the default WSL environment.
- Install the prerequisites like described above.
- In Windows, open the terminal in the `bin/fed/ns3` directory of your MOSAIC installation.
- Call `wsl.exe ./ns3_installer.sh`.

### Installation in Docker environment

This guide gives instructions to execute the ns-3 federate inside a docker container. If you already installed
Expand All @@ -118,10 +129,11 @@ need to manually install ns-3 and can even run ns-3 on Windows hosts.
* Windows - In the settings, share the drive where Eclipse MOSAIC is installed on. You may need to restart docker in the reset tab.
* Linux - Make sure your user account belongs to the unix-group `docker`. You may need to restart your machine.
3. Switch to the location of the Dockerfile in `<mosaic>/bin/fed/ns3`
4. Execute the following command on command line:
`docker build -t ns3-federate` .
4. Execute the following command on command line: `docker build -t ns3-federate .`\
This could take a while to finish.
5. Enter the name of the docker image `etc/runtime.json` in the `ns3`-section into the property `dockerImage`:
5. Enter the name of the docker image `etc/runtime.json` in the `ns3`-section into the property `dockerImage`. Eclipse MOSAIC will then
start the docker container for you. If you try to run the docker container independently it will fail on startup, because the
configuration files in the folder `scratch` are missing.
```json
"federates": [
...
Expand Down
6 changes: 2 additions & 4 deletions content/home/simulator_coupling.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ weight = 19 # Order that this section will appear in.
img_position = "top"
+++

**The Eclipse MOSAIC Co-Simulation Framework flexibly couples simulators from different domains to create a holistic collection of simulation models for different scales. Eclipse MOSAIC improves the development and virtual testing of new Mobility Apps. Simulators can be exchanged according to the scenario and additional simulators can be coupled easily to extend Eclipse MOSAIC.**

{{< simulator_coupling width="100%" >}}

The Eclipse MOSAIC Co-Simulation Framework flexibly couples simulators from different domains to create a holistic
collection of simulation models for different scales. Eclipse MOSAIC improves the development and virtual testing of new
Mobility Apps. Simulators could be exchanged according to the scenario and additional simulators could be coupled easily
to extend Eclipse MOSAIC.

0 comments on commit 67d8a17

Please sign in to comment.