Opened 11 years ago

Closed 11 years ago

#2374 closed defect (fixed)

Backend cannot handle asub of casted records

Reported by: Adrian Pop Owned by: Willi Braun
Priority: high Milestone: 1.9.0
Component: Backend Version: trunk
Keywords: Cc: Lennart Ochel, Willi Braun

Description

Run instantiateModel on
Modelica.Electrical.QuasiStationary.Machines.Examples.TransformerTestbench.

You get for example:

  /*Complex[3]*/(transformer.core.v1)[1] = Modelica.SIunits.ComplexVoltage.'*'.multiply(/*Complex*/(transformer.core.v2[1]), Modelica.SIunits.ComplexVoltage.'constructor'.fromReal(transformer.core.n12, 0));

Hm, if I think more about it, it seems to be an issue with simplification of ASUB(CAST(T_ARRAY, record_array), 1) which should be
translated to: CAST(T_COMPLEX(), ASUB(record_array, 1)).

Change History (7)

comment:1 by Adrian Pop, 11 years ago

This might be a back-end issue actually. Martin can you have a quick look?

comment:2 by Martin Sjölund, 11 years ago

If you want it in the other order, just change it :)
Of course we need to typecast it before it is scalarised, and then you get this issue (it's still sort of correct, but you can further simplify it).

comment:3 by Adrian Pop, 11 years ago

Cc: Lennart Ochel Willi Braun added
Component: FrontendBackend
Owner: changed from Martin Sjölund to Willi Braun
Status: newassigned
Summary: Wrong casting when operator overloading is involved with arraysBackend cannot handle asub of casted records

Well, it does seem correct but it seems that our back-end cannot handle it.

[lib/omlibrary/Modelica 3.2.1/Electrical/QuasiStationary/Machines.mo:2206:9-2206:33:writable] 
Error: Internal error ./Compiler/BackEnd/SimCodeUtil.mo: function createNonlinearResidualEquations failed for equation:
/*Complex[3]*/(transformer.core.im)[3] = Complex.'constructor'.fromReal(0.0, 0) 

I'll make it a back-end ticket.

Last edited 11 years ago by Adrian Pop (previous) (diff)

comment:4 by Martin Sjölund, 11 years ago

It's still just changing simplify to handle it ;)

comment:5 by Adrian Pop, 11 years ago

I'm working on a fix for this. I'll come back with details.

comment:6 by Adrian Pop, 11 years ago

The fix works for the model, running testsuite now to see where we stand.

comment:7 by Adrian Pop, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r17447.

Note: See TracTickets for help on using tickets.