Skip to main content

Experimentation tools on top of OSP simulation models.

Project description

The package includes tools for experimentation on simulation models. In the current version experimentation on top of OSP models is implemented. The package introduces a json5-based file format for experiment specification. Based on this specification

  • a system model link is stored

  • active variables are defined and alias names can be given

  • the simulation base case variable settings are defined

  • a hierarchy of sub-cases can be defined with their dedicated variable settings

  • the common results to be retrieved from simulation runs is defined

Other features are

  • alias variables can address multiple components of the same type, ensuring efficient experimentation.

  • alias variables can vectors, even in FMI2 models. It is possible to set/get slices of such vectors

  • variable settings can be time-based, enabling the definition of scenarios

  • variable retrievals (results) can be time-based (in general and per case), enabling efficient model verification

The package does not support systematic variable sweep with respect to sets of variables. Such sweeps should be performed with separate tools. The package might be compared with navigating through a huge house, where the cases represent the various rooms, while searching for object in a given room is left to separate tools.

The package is designed as support tool for Assurance of Simulation Models, see DNV-RP-0513.

The package is currently under development. More instructions and documentation will be added.

Installation

pip install sim-explorer

Development Setup

1. Install uv

This project uses uv as package manager.

If you haven’t already, install uv, preferably using it’s “Standalone installer” method:

..on Windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

..on MacOS and Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

(see docs.astral.sh/uv for all / alternative installation methods.)

Once installed, you can update uv to its latest version, anytime, by running:

uv self update

2. Install Python

This project requires Python 3.10 or later.

If you don’t already have a compatible version installed on your machine, the probably most comfortable way to install Python is through uv:

uv python install

This will install the latest stable version of Python into the uv Python directory, i.e. as a uv-managed version of Python.

Alternatively, and if you want a standalone version of Python on your machine, you can install Python either via winget:

winget install --id Python.Python

or you can download and install Python from the python.org website.

3. Clone the repository

Clone the sim-explorer repository into your local development directory:

git clone https://github.com/dnv-opensource/sim-explorer path/to/your/dev/sim-explorer

4. Install dependencies

Run uv sync to create a virtual environment and install all project dependencies into it:

uv sync

5. (Optional) Activate the virtual environment

When using uv, there is in almost all cases no longer a need to manually activate the virtual environment.

uv will find the .venv virtual environment in the working directory or any parent directory, and activate it on the fly whenever you run a command via uv inside your project folder structure:

uv run <command>

However, you still can manually activate the virtual environment if needed. When developing in an IDE, for instance, this can in some cases be necessary depending on your IDE settings. To manually activate the virtual environment, run one of the “known” legacy commands:

..on Windows:

.venv\Scripts\activate.bat

..on Linux:

source .venv/bin/activate

6. Install pre-commit hooks

The .pre-commit-config.yaml file in the project root directory contains a configuration for pre-commit hooks. To install the pre-commit hooks defined therein in your local git repository, run:

uv run pre-commit install

All pre-commit hooks configured in .pre-commit-config.yam will now run each time you commit changes.

7. Test that the installation works

To test that the installation works, run pytest in the project root folder:

uv run pytest

Meta

Copyright (c) 2024 DNV AS. All rights reserved.

Siegfried Eisinger - siegfried.eisinger@dnv.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/dnv-opensource/sim-explorer

Contribute

Anybody in the OSP community is welcome to contribute to this code, to make it better, and especially including other features from model assurance, as we firmly believe that trust in our models is needed if we want to base critical decisions on the support from these models.

To contribute, follow these steps:

  1. Fork it https://github.com/dnv-opensource/sim-explorer/fork/

  2. Create an issue in your GitHub repo

  3. Create your branch based on the issue number and type (git checkout -b issue-name)

  4. Evaluate and stage the changes you want to commit (git add -i)

  5. Commit your changes (git commit -am 'place a descriptive commit message here')

  6. Push to the branch (git push origin issue-name)

  7. Create a new Pull Request in GitHub

For your contribution, please make sure you follow the STYLEGUIDE before creating the Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sim_explorer-0.1.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

sim_explorer-0.1.1-py3-none-any.whl (42.8 kB view details)

Uploaded Python 3

File details

Details for the file sim_explorer-0.1.1.tar.gz.

File metadata

  • Download URL: sim_explorer-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sim_explorer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c8a1b689076e0e15e8e02f8c265e0f9e5675196ee147137f4bafda267a0044c4
MD5 d4dddaa7f0cf42e1ce1f6541153c39a8
BLAKE2b-256 96dd33ca6a8e6e6a4772fc6fd557126e5301e5498fbb73e129f6ad0b9f055061

See more details on using hashes here.

Provenance

The following attestation bundles were made for sim_explorer-0.1.1.tar.gz:

Publisher: publish_release.yml on dnv-opensource/sim-explorer

Attestations:

File details

Details for the file sim_explorer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sim_explorer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 42.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sim_explorer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8287aecc42d97a80a0487f3c834c72a2c7c7f4b6b7dc9fbe5ea7299f6d356f3d
MD5 910062c9478915cf6a7a5bf13ff7efa7
BLAKE2b-256 549e87e89979269f5082e948770f46713fa3d19a1c445cd3a9acf7fdee4858dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sim_explorer-0.1.1-py3-none-any.whl:

Publisher: publish_release.yml on dnv-opensource/sim-explorer

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page