UdK-VPT / BuildingSystems

Modelica BuildingSystems library
http://modelica-buildingsystems.de/
BSD 3-Clause "New" or "Revised" License
70 stars 34 forks source link

Example Building1Zone0D fails in OpenModelica #81

Open fab6 opened 7 years ago

fab6 commented 7 years ago

Hi,

I just loaded the latest git version of the BuildingSystems library in openmodelica v1.11.0.

When I tried to run the "Building1Zone0D" example, I get this warning and error:

[20] 14:47:54 Translation Warning
[BuildingSystems.Buildings.Interfaces.SurfaceToConstructionPort: 2:1-22:30]: Connector .BuildingSystems.Buildings.Interfaces.SurfaceToConstructionPort$building1$innerConstructions$toSurfacePort_1 is not balanced: The number of potential variables (29) is not equal to the number of flow variables (2).

[21] 14:47:54 Translation Error
[BuildingSystems.Buildings.Constructions.Walls.WallThermal1DNodes: 14:5-14:39]: Type mismatch in binding lambda = {1.351370344342937}, expected subtype of Real, got type Real[1].

[22] 14:47:54 Translation Error
Error occurred while flattening model BuildingSystems.Buildings.Examples.Building1Zone0D

Do you have a hint, what I am doing wrong? Thank you! Fabian

thorade commented 7 years ago

Hi Fabian, we used Dymola to develop and test our library and unfortunately, not all models run in OpenModelica. This may sometimes be bad modelling on our side, and sometimes it will be a bug on OpenModelica side.

The OpenModelica guys are testing the compatibility continuously here: https://libraries.openmodelica.org/branches/master/BuildingSystems/BuildingSystems.html As you see, some models just fail, including the one you mentioned, here is a link to the error log: https://libraries.openmodelica.org/branches/master/BuildingSystems/files/BuildingSystems_BuildingSystems.Buildings.Examples.Building1Zone0D.err

The warning regarding un-balanced connectors is also discussed in issue #62, the other error is that the two variables have a different type, Real versus Real[1] (an array of length 1, that could be converted into a scalar quite easily).

So, you are not doing anything wrong here, the model just does not work with OpenModelica, and I believe in this case the error is on our side. In the long term we want to become fully OpenModelica and JModelica compatible, but we are not there yet. If you are interested in improving compatibility, we will happily try to help you and merge your changes into our library.

Best regards, Matthis

fab6 commented 7 years ago

Hi Matthis, ok, I understand, thank you for your quick help! I see, that the tests are done with the latest version of openmodelica. Does this have a large impact for the tests of BuildingSystems or has this a minor impact?

Best Regards Fabian

thorade commented 7 years ago

Hi, you can find a comparison overview for the different OM releases here: https://libraries.openmodelica.org/branches/overview-combined.html

Are you on Linux or Windows? For Linux, the OpenModelica developers recommend using the nightlies: https://openmodelica.org/download/download-linux That is also what I use (on a VirtualBox), there are updates every or every second day. So far I have not had any real problems, and if so, the OM developers have usually responded very quickly.

Another comment: Our library is based on the IBPSA library: https://github.com/ibpsa/modelica-ibpsa That library is also getting tested: https://libraries.openmodelica.org/branches/master/IBPSA_latest/IBPSA_latest.html Whatever does not work in the IBPSA core library will also not work in any of the extending libraries.

Best regards, Matthis

thorade commented 7 years ago

Fabian, I added a new label for OpenModelica related issues: https://github.com/UdK-VPT/BuildingSystems/labels/OpenModelica

And here is a quick link to search for BuildingSystems in the OpenModelica Trac: https://trac.openmodelica.org/OpenModelica/search?q=BuildingSystems&ticket=on

fab6 commented 7 years ago

Hi Matthis, great, thanks! Btw. I read somewhere that there is a Building-Modelica user group. Is this still active? This would be great :-) Best Regards Fabian

thorade commented 7 years ago

Hi Fabian, there is the IBPSA library: https://github.com/ibpsa/modelica-ibpsa And at least four libraries that copy&extend these models: AixLib from Aachen, Buildings from Berkley, IDEAS from Leuven and BuildingSystems from Berlin. All four are developed on github and the repositories are linked form the IBPSA Readme. You can read more here: https://scholar.google.com/scholar?cluster=233397093836111969

All these libraries offer some support, either as a wiki, or in the issue tracker, with a homepage, tutorials or a mailing list. For the BuildingSystems library, have a look here: http://modelica-buildingsystems.de/contact.html https://groups.google.com/forum/#!forum/modelica-buildingsystems

If you are instead interested in the Buildings library, then please go to their repository and follow the links. They have a good documentation online, and they also have a Google User Group: https://groups.google.com/forum/#!forum/modelica-buildings

thorade commented 7 years ago

The problem seems to be how BuildingTemplates.Building1Zone0D instantiates the constructionData. We should check what of the following works: vector={scalar}; (that is how it is currently done) each vector=scalar; vector=fill(scalar);

http://book.xogeny.com/behavior/arrays/functions/

fab6 commented 7 years ago

This is not clear to me!? Where can I find "vector={scalar}"? I canot find it in the repository.

thorade commented 7 years ago

Sorry for the confusion, this was just a note to myself, while working on this issue. The problem seems to be in the BuildingTemplate, around lines 85, 99 or 113: https://github.com/UdK-VPT/BuildingSystems/blob/master/BuildingSystems/Buildings/BuildingTemplates/Building1Zone0D.mo

fab6 commented 7 years ago

No, problem. So it is no within the BuildingSystems development!?

thorade commented 7 years ago

We started to look into the issue, and once we find a fix we will upload the fixed code, there is no new code uploaded yet.

fab6 commented 7 years ago

Thanks! Let me know, when I should test something.

BrendanSulliv commented 6 years ago

@thorade Any updates on this? I am using the nightly build of OpenModelica v1.13.0 and Building1Zone0D still fails.

My own research also lead me to believe there is a problem with the constructionData wherein the materialThermalGeneral record has the thermal properties defined as scalar reals but we obviously want to use vectors when we are defining multiple layers of material with multiple nodes within each layer. I've tried fixing it by updating materialThermalGeneral to use vectors but the error persists.

Thoughts?

thorade commented 6 years ago

@UdK-VPT have also tried some things, but did not get it to work. The model works in Dymola and in JModelica, and OpenModelica is working on a new frontend that might solve a couple of problems, but it is not finished/released yet. https://libraries.openmodelica.org/branches/newInst/BuildingSystems/BuildingSystems.html UdK will probably not work on this model before the new frontend has been released. Also, I don't work at UdK anymore. But if you find a solution, then it will for sure be merged into the library!