Repository navigation
Use if-statements in Frames.smallRotation and TransformationMatrices.smallRotation - #4848
Open
hubertus65 wants to merge 1 commit into
Open
hubertus65 wants to merge 1 commit into
hubertus65 wants to merge 1 commit into
Conversation
…smallRotation
Both functions returned their result with an if-expression whose branches
have different sizes (6 and 3) and whose condition is the function input
withResidues:
phi := if withResidues then {...6 elements...} else {...3 elements...};
Branches of different sizes are only allowed for a parameter condition, so
OCT (Modelon Impact) rejects both functions ("If-expression with branches
that have different array sizes must have parameter test-expression").
The size of phi is already fixed by its declaration
phi[if withResidues then 6 else 3], so assign it in an if-statement
instead. OpenModelica 1.27.1 gives bit-identical results before and after
the change for both functions with and without residues; OCT now compiles
and simulates them with the same results.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT
This was referenced Oct 31, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modelica.Mechanics.MultiBody.Frames.smallRotationandFrames.TransformationMatrices.smallRotationreturn their result with an if-expression whose branches have different sizes. The condition is the function inputwithResidues:Branches of different array sizes require a parameter condition. OCT, the compiler of Modelon Impact, therefore rejects both functions:
The declaration
phi[if withResidues then 6 else 3]already fixes the size ofphi. This PR assigns it in an if-statement instead:Verification
The test model calls both functions with and without residues on a rotation
axesRotations({1, 2, 3}, {a, 2*a, -a})witharamping to 1e-3.Nothing else in the MSL calls these functions; they are covered by a new ModelicaTest test on branch
coverage-improvement.🤖 Generated with Claude Code
https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT