Opened 14 years ago
Last modified 13 years ago
#1420 closed defect (fixed)
Array constants are reconstructed in every time step
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Version: | ||
Keywords: | Cc: | Martin Sjölund, |
Description
{{{class A
constant Real i[:] = fill(1, 10000);
Real r = min(j*time for j in i);
end A;}}}
This will cause the array constant to be created in every single time step. The same goes for functions that take a lookup array + index.
Implementation tips: Use the common subexpression elimination that is performed for functions right now. We need something similar; but for Modelica arrays you need to do a top-down traversal instead of bottom-up due to the way arrays are represented in the C runtime.
Note:
See TracTickets
for help on using tickets.
Fixed, this testcase now generates Real r = time. Also, array constants in simulation code are now referenced directly by pointer