Skip to content

Python: export components without a source without a source attribute (#1697) - #1698

Merged
arun3688 merged 2 commits into
OpenModelica:masterfrom
adrpo:ssd-component-no-source
Nov 11, 2026
Merged

arun3688 merged 2 commits into
OpenModelica:masterfrom
adrpo:ssd-component-no-source

Conversation

@adrpo

@adrpo adrpo commented Nov 10, 2026

Copy link
Copy Markdown
Member

Related Issues

Fixes #1697

Purpose

A component without a source (an architecture placeholder with connectors but no FMU yet) did not
survive an SSP round trip. Its source="" came back as source="." (Path("").as_posix() is "."),
and other SSP importers drop such components and their connections. An SSD where the component has no
source attribute, which is the correct form in SSP 2.0 (source is use="optional"), could not be
imported at all because of Path(None).

Approach

  • Import: a missing, empty or "." source all mean no source (fmuPath / filePath is None).
    "." is still read, for SSPs written by earlier versions.
  • Export: an FMU or table component without a source gets no source attribute.
  • Instantiation: a component without a source fails with
    Component '<name>' has no source FMU and cannot be simulated instead of a confusing path error.

New test api/componentNoSource1.py with the resource componentNoSource. It imports one component of
each kind (source="", no attribute, source="."), adds a real FMU, exports, checks the source
attributes, re-imports and exports again, and checks the instantiation error. The SSDs it exports
validate against schema/ssp/SystemStructureDescription.xsd. The test fails on master with the
TypeError. Locally all api and simulation tests pass on Linux (9 are skipped on this platform).


🤖 Generated with Claude Code

…OpenModelica#1697)

A component without a source (an architecture placeholder) was read from
source="" and written back as source=".", since Path("").as_posix() is ".";
other SSP importers drop such components. An SSD without the source
attribute could not be imported at all (Path(None)).

SSP 2.0 makes source optional: a component without a source has no source
attribute. Read a missing, empty or "." source as no source, leave the
attribute out on export (FMUs and tables), and fail instantiation with a
clear error. New test api/componentNoSource1.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adrpo adrpo self-assigned this Nov 10, 2026
@adrpo adrpo added the project/openscaling OpenSCALING related issues and pull requests label Nov 10, 2026
@adrpo
adrpo requested a review from arun3688 November 10, 2026 22:52
The other placeholders keep no source attribute and the connections stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.22%. Comparing base (3046f82) to head (2a64c6e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1698   +/-   ##
=======================================
  Coverage   30.22%   30.22%           
=======================================
  Files          74       74           
  Lines       14661    14661           
  Branches     9432     9432           
=======================================
  Hits         4431     4431           
  Misses       8892     8892           
  Partials     1338     1338           
Flag Coverage Δ
linux 30.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arun3688
arun3688 merged commit 19d9621 into OpenModelica:master Nov 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project/openscaling OpenSCALING related issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: components without a source are exported with source="."

2 participants