Opened 5 years ago

Closed 5 years ago

#5987 closed defect (fixed)

Ragged arrays not yet supported by the NF

Reported by: Francesco Casella Owned by: Per Östlund
Priority: blocker Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc: Michael Wetter

Description

Please check Buildings.Examples.HydronicHeating.TwoRoomsWithStorage. The NF reports:

[Buildings latest/HeatTransfer/Data/OpaqueConstructions.mo:9:4-11:111:writable]
Error: Ragged dimensions are not yet supported (from dimension '{3, 1}')

I'm not sure I understand where the ragged array is from this message. @perost can you please comment on this? There are several models in the Buildings library that fail because of this issue.

Change History (13)

in reply to:  description comment:1 by Per Östlund, 5 years ago

Replying to casella:

I'm not sure I understand where the ragged array is from this message. @perost can you please comment on this?

It's when array elements contain arrays with different sizes, like this:

model A
  parameter Integer n;
  Real x[n];
end A;

model B
  A a[2](n = {2, 3});
end B;

This is hard to handle in the NF since complex arrays aren't expanded until the flattening phase.

comment:2 by Francesco Casella, 5 years ago

I see.

Q1: How long would it take to implement this in the NF?
Q2: Is any workaround possible using some parts of the OF to handle this for the time being?

Thanks!

comment:3 by Francesco Casella, 5 years ago

Summary: Issue with ragged arrays and the NF?Ragged arrays not yet supported by the NF

in reply to:  2 comment:4 by Per Östlund, 5 years ago

Replying to casella:

Q1: How long would it take to implement this in the NF?

I need to figure out a solution to this rather tricky issue, which unfortunately is not something I can give a time estimate on.

Q2: Is any workaround possible using some parts of the OF to handle this for the time being?

Not short of using the entire OF. It's not really a case of missing functionality but fundamentally different ways of handling the instantiation.

comment:5 by Francesco Casella, 5 years ago

OK. It's not really urgent, maybe I'll discuss this with Michael Wetter.

I understand that if the dimensions are the same, the NF can manage. Is that correct?

in reply to:  5 comment:6 by Per Östlund, 5 years ago

Replying to casella:

I understand that if the dimensions are the same, the NF can manage. Is that correct?

Yes, if a dimension evaluates to an array it will check if all elements have the same value and just use that value.

comment:7 by Francesco Casella, 5 years ago

Cc: Michael Wetter added

@mwetter, could you comment on how much is this feature important for you?

comment:8 by Michael Wetter, 5 years ago

Ragged arrays are important and used in many places: Consider a wall with 20 cm concrete and 5 cm insulation. Then, these are modeled with two instances of Buildings.HeatTransfer.Conduction.SingleLayer, but each instance has a different number of states because they require a different spatial grid to discretize the heat equation.
A similar pattern is used at the room-level: A room can have any number of exterior constructions, but these constructions can have different number of material layers (e.g., one can be a roof, and one can be a wall, with each having a different number of material layers).

comment:9 by Francesco Casella, 5 years ago

Yes, I understand this well.

Supporting this feature in the NF is not trivial. As you know, the NF does not expand arrays until the last minute, which is a pre-requisite for our next-generation backend that will not expand arrays at all. I guess that will be interesting for your as well.

For the time being I think we can continue fixing the other issues. At some point we should have a strategic discussion between OSMC and LBL to see where we want to go.

comment:10 by Francesco Casella, 5 years ago

@perost, you did some work in this area. Now most of these models are failing with no error message, instead of simply complaining about ragged arrays not being implemented.

Could you quickly comment on the status and perspectives?

Thanks!

in reply to:  10 comment:11 by Per Östlund, 5 years ago

Replying to casella:

@perost, you did some work in this area. Now most of these models are failing with no error message, instead of simply complaining about ragged arrays not being implemented.

Could you quickly comment on the status and perspectives?

Thanks!

Some of the models that used to fail now work, and many of the models that now fail without an error is failing due to unrelated issues (they just get further in the compilation process now). The support for ragged dimensions is by no means complete, but it might be good enough for Buildings now.

comment:12 by Francesco Casella, 5 years ago

Excellent, thanks!

As they write on French railroad crossings: "Danger, un train peut en cacher un autre...".

I guess I can close this ticket. I opened #6028 to track the next train.

comment:13 by Francesco Casella, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.