Skip to content

boschglobal/dse.sdp

Repository files navigation

Dynamic Simulation Environment - Simulation Development Platform

Containers Super Linter
Open in GitHub Codespaces

Introduction

Simulation Development Platform (SDP) for the Dynamic Simulation Environment (DSE) Core Platform.

User Guide

Project Structure

dse.sdp
├── .devcontainer/          <-- Dev Container definition.
│   └── Dockerfile-builder  <-- Builder tool container appliance (Dockerfile).
├── actions                 <-- GitHub Actions (for Builder, Report, and Simer containers).
├── ast                     <-- AST tools.
├── doc                     <-- Project documentation.
├── dsl                     <-- DSL parser (using Chevrotain).
├── examples
│   ├── graph               <-- Graph examples (for the Report tool).
│   ├── models              <-- Model examples, used by E2E tests.
│   ├── openloop            <-- Open Loop simulation using an FMU-based linear equation model.
│   ├── openloop_lua        <-- Open Loop simulation implemented with Lua models.
│   ├── notebook            <-- Jupyter-based simulation example.
│   └── vscode              <-- VS Code integration examples.
├── graph                   <-- Graph tool (including the Report tool).
│   ├── build/package/
│   │   └── report/         <-- Report tool container appliance (Dockerfile).
│   └── cmd/graph/
│       └── reports/        <-- Reports, packaged with the Report container.
├── licenses                <-- Third-party licenses.
├── lsp                     <-- VS Code Language Server.
├── tests
│   ├── e2e                 <-- End-to-end (E2E) tests.
│   ├── scripts             <-- Scripts used by E2E tests.
│   └── testdata            <-- Test data used by E2E tests.
├── Makefile                <-- Repo-level Makefile.
└── Taskfile.yml            <-- Taskfile containing supporting automation for E2E tests.

Usage

Hint: GitHub Codespaces is known to work with Chrome and Edge browsers. Firefox may prevent normal operation because of Firefox’s "Enhanced Tracking Protection" setting. Try setting it to Standard to resolve the issue.

Examples

Running ModelC Example Simulations

Start a Codespace, then run the following commands in the terminal.

# Check your environment.
$ dse-env
DSE_MODELC_VERSION=2.1.30
DSE_REPORT_IMAGE=ghcr.io/boschglobal/dse-report:latest
DSE_SIMER_IMAGE=ghcr.io/boschglobal/dse-simer:latest

# Setup the examples (will download ModelC examples).
$ make examples
$ ls out/examples/modelc/
benchmark/  binary/  extended/  gateway/  gdb/  minimal/  ncodec/  runtime/  simer/  transform/

# Validate a simulation using the Report tool.
$ dse-report out/examples/modelc/minimal
...
=== Summary ===================================================================
[PASS] Duplicate Writes Check
[PASS] ModelInstance Name Check
[PASS] Model UID Check
[PASS] Channel 'expectedModelCount'
[PASS] Count 'ModelInst' in AST and SIM
Ran 5 Reports | Passed: 5 | Failed: 0

# Run a simulation using Simer.
$ dse-simer out/examples/modelc/minimal
...
2) Run the Simulation ...
2) Controller exit ...

# Build and run a simulation using the DSL.
$ cd examples/vscode
$ make build
...
$ make report
...
$ make run
...

Hint: Find more information about the Simer command options here.

Hint: Find more information about the Report command options here.

Build

WSL Linux (local development)

# Install NVM and Node.js, if necessary.
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
$ nvm ls-remote
$ nvm install v22.15.0

# Install prerequisites.
$ sudo npm install -g vsce
$ sudo npm install -g http-server
$ sudo npm install -g typescript

# Set your path to include ~/.local/bin if necessary. Permanent changes
# can be made to your '~/.bashrc' or '~/.profile' file.
$ export PATH="$HOME/.local/bin:$PATH"

# Clone the repo.
$ git clone https://github.boschdevcloud.com/fsil/dse.sdp.git
$ cd dse.sdp

# Set up the SDP (local install).
$ make
$ make build install

# Build containerised tools.
$ make docker

# Optionally use local container images.
$ export DSE_BUILDER_IMAGE=dse-builder:test
$ export DSE_REPORT_IMAGE=dse-report:test
$ export DSE_SIMER_IMAGE=dse-simer:test
$ export DSE_SIMER_IMAGE=simer:test  # (Optional) Alternative name.

# Run tests.
$ make run_graph
$ make test
$ make test_e2e

# Generate documentation.
$ make generate

# Remove temporary build artifacts.
$ make clean
$ make cleanall

Developer Notes

Dev Containers Extension for VS Code and WSL

Note: Dev Containers is not supported by VSCodium, although workarounds may still exist.

Install VS Code Extensions

  1. Install the Dev Containers extension (Ctrl-Shift-X, then search for "Dev Containers").
  2. Install the WSL extension (Ctrl-Shift-X, then search for "WSL").
  3. Install the Codespaces extension (Ctrl-Shift-X, then search for "Codespaces").
  4. From the Remote Explorer, select a WSL target and then click Connect in New Window. A new VS Code editor will open.
  5. Press F1 to bring up the Command Palette and type Dev Containers: Reopen in Container.

You may be prompted to install Docker in WSL. If prompted, follow the installation steps in WSL.

The WSL indicator appears in the bottom-left corner of the VS Code window. The Remote Explorer, added by the WSL extension, will show available WSL targets.

Start VS Code with a WSL Target (and Dev Container)

Using a WSL Bash terminal:

# Open a new VS Code editor connected to this repo.
cd ~/git/workspace/dse.sdp
code .

# In VS Code, press `F1` and type `Dev Containers: Reopen in Container`.

# Open a Bash terminal to access the Dev Container environment.
codespace ➜ /workspaces/dse.sdp (main) $ which task
/usr/local/bin/task
codespace ➜ /workspaces/dse.sdp (main) $

Using VS Code:

  1. Click Open a Remote Window in the bottom-left corner, then choose Connect to WSL.
  2. From the Remote Explorer, select a WSL target and then click Connect in Current Window. A new VS Code editor will open.
  3. Select Open Folder and navigate to your dse.sdp repository. Previously opened repositories will be listed in the Remote Explorer.

After that, the container will build, and the environment will eventually be available in your terminal window.

Proxy Setup When Running Inside a Dev Container

For Docker CLI proxy configuration, see the Docker proxy setup documentation.

Example:

$ cat ~/.docker/config.json

Additional Resources

Contribute

Please refer to the CONTRIBUTING.md file.

License

This project is open-sourced under the Apache-2.0 license. See the LICENSE and NOTICE files for details.

Third-Party Licenses

Third-Party Licenses

About

Simulation Development Platform of the Dynamic Simulation Environment Core Platform.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors