Opened 11 years ago

Closed 11 years ago

#2374 closed defect (fixed)

Backend cannot handle asub of casted records

Reported by: adrpo Owned by: wbraun
Priority: high Milestone: 1.9.0
Component: Backend Version: trunk
Keywords: Cc: lochel, wbraun

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 Changed 11 years ago by adrpo

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

comment:2 Changed 11 years ago by sjoelund.se

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 Changed 11 years ago by adrpo

  • Cc lochel wbraun added
  • Component changed from Frontend to Backend
  • Owner changed from sjoelund.se to wbraun
  • Status changed from new to assigned
  • Summary changed from Wrong casting when operator overloading is involved with arrays to Backend 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 adrpo (previous) (diff)

comment:4 Changed 11 years ago by sjoelund.se

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

comment:5 Changed 11 years ago by adrpo

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

comment:6 Changed 11 years ago by adrpo

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

comment:7 Changed 11 years ago by adrpo

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r17447.

Note: See TracTickets for help on using tickets.