Skip to content

OCT rejects Frames.smallRotation (if-expression with branches of different sizes) - #3

Open
hubertus65 wants to merge 1 commit into
impact-failuresfrom
impact-failure-IfExpressionDifferentSizesInFunction
Open

hubertus65 wants to merge 1 commit into
impact-failuresfrom
impact-failure-IfExpressionDifferentSizesInFunction

Conversation

@hubertus65

Copy link
Copy Markdown
Owner

Adds ImpactFailures.IfExpressionDifferentSizesInFunction, a minimal model with MSL 4.1.0 that fails in Modelon Impact (impact.modelon.cloud, checked 2026-10-31).

Failure: OCT rejects both functions:

Error at line 21, column 10, in function 'Modelica.Mechanics.MultiBody.Frames.TransformationMatrices.smallRotation':
    If-expression with branches that have different array sizes must have parameter test-expression:
    {T[2,3], - T[1,3], T[1,2], T[1,1] - 1, T[2,2] - 1, T[1,1] * T[2,2] - T[2,1] * T[1,2] - 1} has size [6]
    {T[2,3], - T[1,3], T[1,2]} has size [3]

Trigger: phi := if withResidues then {...6 elements...} else {...3 elements...},
where withResidues is a function input, not a parameter expression. This follows the
specification rule that branches of different sizes need a parameter condition, so the MSL code is the
problem here rather than OCT. OpenModelica 1.27.1 accepts it.

Workaround in the MSL: modelica#4848 assigns phi in an
if-statement. Its size is already fixed by the declaration phi[if withResidues then 6 else 3].
OpenModelica results are bit-identical, and OCT compiles and simulates the changed functions.

Upstream MSL pull request: modelica#4848

🤖 Generated with Claude Code

https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT

OCT rejects Frames.smallRotation (if-expression with branches of different sizes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant