Skip to content
Success

Changes

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)

Summary

  1. [BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835) (details)
  2. [NB] Fix symbolic differentiation losing derivative function bodies (#15834) (details)
  3. [SimRT] More helpful message when an initialization NLS fails (#15433) (details)
Commit c62759fd85b3043c749089e8504651cf5c35b6e2 by Martin Sjölund
[BackEnd] Fail getWhenEquationExpr instead of returning uninitialized outputs (#15835)

The try/else branch reported an internal error but then returned normally,
leaving both outputs uninitialized.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/BackEnd/BackendEquation.mo (diff)
Commit b4833fb10cc4c6139af5003472f1b8831e297f5d by Martin Sjölund
[NB] Fix symbolic differentiation losing derivative function bodies (#15834)

differentiateFunction installed the differentiated algorithm section by
creating a new class pointer, but the "fake" function node created earlier
for recursive differentiation still held the old pointer. Its cached
function is what Function.getDerivative/addDiffInfo put back into the
function tree when the same call is differentiated again, so codegen
received the original (underived) body: the generated derivative never
assigned its outputs and e.g. function_diff.mos crashed with a stack
overflow whenever the uninitialized return slot happened to be NaN.
Update the class pointer in place instead so every node copy sees the
differentiated body.

Also add a use-before-assign check for backend-generated functions (the
frontend check only runs in typeFunctionBody, which generated functions
never pass through): provably unassigned outputs or uses are reported as
errors, and variables that cannot be proven to always be assigned are
explicitly initialized to zero with a warning, as recommended by the
specification.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The file was modifiedOMCompiler/Compiler/Util/Error.mo (diff)
The file was modifiedOMCompiler/Compiler/NFFrontEnd/NFFunction.mo (diff)
The file was modifiedOMCompiler/Compiler/NBackEnd/Util/NBDifferentiate.mo (diff)
Commit 4e402b6637620165d0345504e23818cf487dc39e by adrian.pop
[SimRT] More helpful message when an initialization NLS fails (#15433)

When a nonlinear system fails during initialization, the runtime hint
"proper start-values for some of the following iteration variables might help"
was too terse to be actionable. Some models (e.g. the parallel-cable models in
ticket #15433, FourCablesHoldingPlatform) fail to initialize under the default
tearing because the iteration variables OpenModelica selects have no suitable
start values: the model was developed with another tool that tears differently,
so the model's start values apply to a different set of iteration variables.

Reword the hint to explain this and point to remedies (give start values to the
listed iteration variables, or select a different tearing method, e.g.
--tearingMethod=omcTearing). The per-variable list that follows already prints
each iteration variable's start/nominal values, which now makes the "start=0"
(unset) culprits obvious. Fires only when an initialization system actually
fails, so no healthy model is affected.
The file was modifiedOMCompiler/SimulationRuntime/c/simulation/solver/nonlinearSystem.c (diff)