Skip to content

Commit

Permalink
Rename package to sim-explorer and fix pipeline issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorgelmh committed Nov 5, 2024
1 parent 7a0e186 commit 8b0365a
Show file tree
Hide file tree
Showing 41 changed files with 114 additions and 106 deletions.
2 changes: 1 addition & 1 deletion docs/source/cases_specification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Definition of case variables
The unique identification of a variable in a system requires an identificator containing both the component (instance) and the variable name (or reference).
The identificators can thus become lengthy and difficult to work with.
In addition, there are system models with several components from the same model, where the user might want to address all of them (e.g. max power setting of thrusters). Moreover, FMI2 knows only scalar variables, while it would be nice to also be able to work with vectors, tables and their elements.
Therefore case study adops the principle that case variables are speparately defined.
Therefore sim explorer adops the principle that case variables are speparately defined.
The `variables` entry is a dictionary where each element is specified as

`identificator : [component(s), variable_name(s), description]`
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# -- Project information -----------------------------------------------------

project = "case_study"
project = "sim_explorer"
copyright = "2024, DNV AS. Released as OpenSource."
author = "Siegfried Eisinger, DNV Simulation Technology Team, SEACo project team"

Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. case_study documentation master file, based on
.. sim_explorer documentation master file, based on
sphinx-quickstart on Wed Jul 6 21:16:21 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
case_study: Python Package for managing simulation experiments
sim_explorer: Python Package for managing simulation experiments
==============================================================

Check warning on line 7 in docs/source/index.rst

View workflow job for this annotation

GitHub Actions / build_and_publish_documentation / Build and publish documentation

Title underline too short.

.. toctree::
Expand Down
12 changes: 6 additions & 6 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Modules documentation
=====================
This section documents the contents of the case_study package.
This section documents the contents of the sim_explorer package.


json5
-----
Python module for working with json5 files.

.. autoclass:: case_study.json5.Json5
.. autoclass:: sim_explorer.json5.Json5
:members:
:show-inheritance:

Expand All @@ -16,7 +16,7 @@ Simulator Interface
-------------------
Python module providing the interface to the simulator. Currently only Open Simulation Platform (OSP) is supported

.. autoclass:: case_study.simulator_interface.SimulatorInterface
.. autoclass:: sim_explorer.simulator_interface.SimulatorInterface
:members:
:show-inheritance:

Expand All @@ -25,14 +25,14 @@ Cases
--------
Python module to manage cases with respect to reading \*.cases files, running cases and storing results

.. autoclass:: case_study.case.Cases
.. autoclass:: sim_explorer.case.Cases
:members:
:show-inheritance:

.. autoclass:: case_study.case.Case
.. autoclass:: sim_explorer.case.Case
:members:
:show-inheritance:

.. autoclass:: case_study.case.Results
.. autoclass:: sim_explorer.case.Results
:members:
:show-inheritance:
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "case_study"
name = "sim_explorer"
version = "0.0.1"
description = "Experimentation tools on top of OSP simulation models."
authors = [
Expand Down Expand Up @@ -50,7 +50,7 @@ build-backend = "setuptools.build_meta"
"./doc/source/conf.py",
"./tests/data",
]
src = ["case_study"]
src = ["sim_explorer"]
lint.ignore = [
"E501", # Line length too long
"D100", # Missing docstring in public module
Expand Down
7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Sphinx>=7.3
sphinx-argparse-cli>=1.16
myst-parser>=3.0
furo>=2024.5
sourcery==1.21

-r requirements.txt
File renamed without changes.
19 changes: 10 additions & 9 deletions case_study/__main__.py → sim_explorer/__main__.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
import argparse
import importlib.metadata
from case_study.case import Cases, Case, Results

from sim_explorer.case import Case, Cases


def cli_main():
"""Provide a Command Line Interface for sim-explorer.
`see Python tutorial for working with argparse <https://docs.python.org/3/howto/argparse.html>`_
"""
__version__ = importlib.metadata.version("case_study")
parser = argparse.ArgumentParser(prog="case_study")
__version__ = importlib.metadata.version("sim_explorer")
parser = argparse.ArgumentParser(prog="sim_explorer")
parser.add_argument("-V", "--version", action="version", version=__version__)
parser.add_argument("cases", type=str, help="The sim-explorer specification file.")
parser.add_argument("--info", action="store_true", help="Display the structure of the defined cases.")
parser.add_argument("--info", action="store_true", help="Display the structure of the defined cases.")
parser.add_argument("--run", type=str, help="Run a single case.")
parser.add_argument("--Run", type=str, help="Run a case and all its sub-cases.")
args = parser.parse_args()
cases = Cases( args.cases)
cases = Cases(args.cases)
print("ARGS", args)
if not isinstance(case, Cases):
if not isinstance(cases, Cases):
print(f"Instantiation of {args.cases} not successfull")
if args.info is not None:
print(cases.info())
elif args.run is not None:
case = cases.case_by_name( args.run)
case = cases.case_by_name(args.run)
if not isinstance(case, Case):
print(f"Case {args.case} not found in {args.cases}")
case.run()
elif args.Run is not None:
case = cases.case_by_name( args.Run)
case = cases.case_by_name(args.Run)
if not isinstance(case, Case):
print(f"Case {args.case} not found in {args.cases}")
for c in case.iter():
c.run()


if __name__ == "__main__":
cli_main()
cli_main()
2 changes: 1 addition & 1 deletion case_study/assertion.py → sim_explorer/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def update_namespace(sym: dict):
@staticmethod
def vector(x: tuple | list):
assert isinstance(x, (tuple, list)) and len(x) == 3, f"Vector of length 3 expected. Found {x}"
return x[0] * Assertion.N.i + x[1] * Assertion.N.j + x[2] * Assertion.N.k # type: ignore
return x[0] * Assertion.N.i + x[1] * Assertion.N.j + x[2] * Assertion.N.k # type: ignore

def assert_single(self, subs: list[tuple]):
"""Perform assertion on a single data point.
Expand Down
4 changes: 2 additions & 2 deletions case_study/case.py → sim_explorer/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .simulator_interface import SimulatorInterface, from_xml

"""
case_study module for definition and execution of simulation experiments
sim_explorer module for definition and execution of simulation experiments
* read and compile the case definitions from configuration file
Note that Json5 is here restriced to 'ordered keys' and 'unique keys within an object'
* set the start variables for a given case
Expand Down Expand Up @@ -563,7 +563,7 @@ def get_case_variables(self) -> dict[str, dict]:
'type':CosimVariableType,
'causality':CosimVariableCausality,
'variability': CosimVariableVariability}.
Optionally a description of the alias variable may be provided (and added to the dictionary).
"""
variables = {}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


"""
case_study module for definition and execution of simulation experiments
sim_explorer module for definition and execution of simulation experiments
* read and compile the case definitions from configuration file
Note that Json5 is here restriced to 'ordered keys' and 'unique keys within an object'
* set the start variables for a given case
Expand Down
2 changes: 1 addition & 1 deletion tests/data/BouncingBall0/BouncingBall.cases
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
header: {
name : 'BouncingBall',
description : 'Simple Case Study with the basic BouncingBall FMU (ball dropped from h=1m',
description : 'Simple sim explorer with the basic BouncingBall FMU (ball dropped from h=1m',
modelFile : "OspSystemStructure.xml",
timeUnit : "second",
variables : {
Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall0/results_base.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'base',
dateTime : '2024-11-04T11:44:30.119146',
dateTime : '2024-11-05T10:47:43.734104',
cases : 'BouncingBall',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-03T22:37:08.285872',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-05T10:44:47.727848',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall0/results_gravity.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'gravity',
dateTime : '2024-11-04T11:44:35.921661',
dateTime : '2024-11-05T10:47:51.210550',
cases : 'BouncingBall',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-03T22:37:08.285872',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-05T10:44:47.727848',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall0/results_restitution.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'restitution',
dateTime : '2024-11-04T11:44:33.311249',
dateTime : '2024-11-05T10:47:47.867022',
cases : 'BouncingBall',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-03T22:37:08.285872',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-05T10:44:47.727848',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall0/results_restitutionAndGravity.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'restitutionAndGravity',
dateTime : '2024-11-04T11:44:38.563853',
dateTime : '2024-11-05T10:47:54.443552',
cases : 'BouncingBall',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-03T22:37:08.285872',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall0/BouncingBall.cases',
casesDate : '2024-11-05T10:44:47.727848',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
2 changes: 1 addition & 1 deletion tests/data/BouncingBall3D/BouncingBall3D.cases
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{header : {
name : 'BouncingBall3D',
description : 'Simple Case Study with the 3D BouncingBall FMU (3D position and speed',
description : 'Simple sim explorer with the 3D BouncingBall FMU (3D position and speed',
modelFile : "OspSystemStructure.xml",
timeUnit : "second",
variables : {
Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall3D/base.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'base',
dateTime : '2024-11-04T11:44:08.031425',
dateTime : '2024-11-05T10:47:31.726809',
cases : 'BouncingBall3D',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-03T21:49:56.360601',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-05T10:44:47.724849',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall3D/gravity.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'gravity',
dateTime : '2024-11-04T11:44:09.197116',
dateTime : '2024-11-05T10:47:33.082558',
cases : 'BouncingBall3D',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-03T21:49:56.360601',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-05T10:44:47.724849',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall3D/restitution.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'restitution',
dateTime : '2024-11-04T11:44:08.628354',
dateTime : '2024-11-05T10:47:32.452404',
cases : 'BouncingBall3D',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-03T21:49:56.360601',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-05T10:44:47.724849',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
6 changes: 3 additions & 3 deletions tests/data/BouncingBall3D/restitutionAndGravity.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'restitutionAndGravity',
dateTime : '2024-11-04T11:44:09.695343',
dateTime : '2024-11-05T10:47:33.612141',
cases : 'BouncingBall3D',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-03T21:49:56.360601',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-11-05T10:44:47.724849',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
2 changes: 1 addition & 1 deletion tests/data/BouncingBall3D/test_case.js5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ header : {
case : 'restitutionAndGravity',
dateTime : '2024-10-31T12:17:00.240916',
cases : 'BouncingBall3D',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/sim_explorer/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '2024-10-31T12:00:16.724092',
timeUnit : 'second',
timeFactor : 1000000000.0},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/BouncingBall3D/test_results.js5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ header : {
case : 'restitution',
dateTime : '1924-01-14T00:00:00',
cases : 'BouncingBall3D',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/BouncingBall3D/BouncingBall3D.cases',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/sim_explorer/tests/data/BouncingBall3D/BouncingBall3D.cases',
casesDate : '1924-01-13T00:00:00',
timeUnit : 'second',
timeFactor : 1000000000.0},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/MobileCrane/MobileCrane.cases
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{header : {
name : 'MobileCrane',
description : 'Case Study with the MobileCrane FMU (standalone)',
description : 'sim explorer with the MobileCrane FMU (standalone)',
modelFile : "OspSystemStructure.xml",
timeUnit : "second",
variables : {
Expand Down
6 changes: 3 additions & 3 deletions tests/data/MobileCrane/results_base.js5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
header : {
case : 'base',
dateTime : '2024-11-04T11:44:45.704941',
dateTime : '2024-11-05T10:48:03.061505',
cases : 'MobileCrane',
file : 'C:/Users/eis/Documents/Projects/Simulation_Model_Assurance/case_study/tests/data/MobileCrane/MobileCrane.cases',
casesDate : '2024-11-03T07:06:17.942318',
file : 'C:/Users/JORMEN/Documents/SeaCo/case_study/tests/data/MobileCrane/MobileCrane.cases',
casesDate : '2024-11-05T10:44:47.724849',
timeUnit : 'second',
timeFactor : 1000000000.0},

Expand Down
Loading

0 comments on commit 8b0365a

Please sign in to comment.