Skip to content

OCT StackOverflowError on a sum over time-varying Complex (QuasiStatic MutualInductor) - #1

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

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

Conversation

@hubertus65

Copy link
Copy Markdown
Owner

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

Failure: the OCT compiler crashes while compiling this model:

Compiler crashed:
java.lang.StackOverflowError
  at org.jmodelica.modelica.compiler.FRecordConstructor.<init>(Unknown Source)
  at org.jmodelica.modelica.compiler.FRecordType.createRecordConstructorCell(Unknown Source)
  at org.jmodelica.modelica.compiler.FType.createRecordConstructor(Unknown Source)
  at org.jmodelica.modelica.compiler.FExp.scalarize(Unknown Source)
  at org.jmodelica.modelica.compiler.FExp.scalarRecordFExp(Unknown Source)
  ...

Trigger: the voltage equation of MutualInductor, a sum over time-varying Complex operator
records: v[l] = sum(j*omega*L[l, k]*i[k] for k in 1:m). A local copy of the component with
sum({j*omega*L[l, k]*i[k] for k in 1:m}) crashes the same way. A copy with real-valued scalar
products, v[l] = j*omega*Complex(L[l, :]*i.re, L[l, :]*i.im), compiles and simulates.

Other tools: OpenModelica 1.27.1 simulates this model, and its currents match the analytic
solution. Dymola 2026x translates it.

Workaround in the MSL: modelica#4846 rewrites the sum in real
arithmetic. OpenModelica results are unchanged within 4.3e-13.

Upstream MSL pull request: modelica#4846

🤖 Generated with Claude Code

https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT

OCT StackOverflowError on a sum over time-varying Complex (QuasiStatic MutualInductor)

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