Opened 6 years ago
#5006 new defect
SimCode fails on array equations inside if equation
Reported by: | Per Östlund | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | Backend | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: |
Description
The frontend doesn't scalarize array equations involving function calls, but it seems the backend can't handle this when the equations are inside an if equation. For example:
function f2 input Real x[:]; output Real y[:] = x; end f2; model test Real x[3]; equation if time > 1 then x = f2({time, time, time}); else x = f2({time, time, time}); end if; end test;
This gives the error:
[SimCodeUtil.mo:2466:7-2466:46:writable] Error: Internt fel function createNonlinearResidualEquationsComplex failed for: {0.0, 0.0, 0.0} = x - f2({time, time, time}) Error: Internt fel function createNonlinearResidualEquations failed [SimCodeUtil.mo:5180:7-5180:46:writable] Error: Internt fel complex equations currently only supported on form v = functioncall(...). Equation: {0.0, 0.0, 0.0} = x - f2({time, time, time}) solve for {x[1],x[3],x[2]} [SimCodeUtil.mo:1366:5-1366:77:writable] Error: Internt fel createEquationsForSystems failed [SimCodeUtil.mo:636:5-636:146:writable] Error: Internt fel function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]
I haven't seen any actual models that use this pattern. I found it because the new frontend decided what to scalarize before doing simplifications, so it wouldn't scalarize matrix constructors (which are translated into cat
calls). I'll fix that, but fixing this issue would still be nice since it would give the frontend more flexibility when it comes to array equations.
Note:
See TracTickets
for help on using tickets.