Opened 6 years ago

Closed 6 years ago

#5115 closed defect (fixed)

The NF does not expand array() operator in Modelica.Magnetics.FundamentalWave models

Reported by: casella Owned by: perost
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Please consider Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.AIMC_Conveyor. The compilation of the C code fails with errors on expressions involving sine and cosine function calls on temp variables.

A search for 'sin(' in the NF-flattened model reveals the following equation:

  vfController.y = array(sin({vfController.x + vfController.BasePhase + vfController.orientation[1], vfController.x + vfController.BasePhase + vfController.orientation[2], vfController.x + vfController.BasePhase + vfController.orientation[3]}[$i1]) for $i1 in 1:3) * vfController.amplitude;

which the old FE expands into

  vfController.y[1] = sin(vfController.x + vfController.BasePhase + vfController.orientation[1]) * vfController.amplitude;
  vfController.y[2] = sin(vfController.x + vfController.BasePhase + vfController.orientation[2]) * vfController.amplitude;
  vfController.y[3] = sin(vfController.x + vfController.BasePhase + vfController.orientation[3]) * vfController.amplitude;

I guess array operators should not be passed to the back-end in general, at least as long as the current back-end is in place.

Change History (2)

comment:1 Changed 6 years ago by casella

There are about 30 models affected by this issue in the MSL

comment:2 Changed 6 years ago by perost

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

The NF still doesn't expand array constructors (by design, it could easily do so if needed), but the errors involving sine and cosine expressions no longer seem to occur. The only remaining issue seems to be the usual record issues.

If I were to guess I'd say that the issue was caused by Complex expressions (e.g. Complex.'^') that the NF now evaluate, since the NF recently started to evaluate constant bindings of complex components regardless of the variability of the component.

Note: See TracTickets for help on using tickets.