- Index
- » Programming
- » Modelica Language
- » Flat Modelica
Flat Modelica
Flat Modelica
Hello,
Is there a documentation available anywhere that lays out the rules by which the "flat" code is generated from a given Modelica model?
(I.e. when you press the "Instantiate Model" button in the OpenModelica Connection Editor)
The code is quite different from what Dymola gives you as flat code.
Regards,
David
Re: Flat Modelica
No, there is not
- sjoelund.se
- 1700 Posts
Re: Flat Modelica
Hi,
Each Modelica tool has its own way of generating Flat Modelica and no standard on how it should look has been made yet.
Basically the rules of getting from Modelica code to Flat Modelica code are in the Modelica Specification
and all tools are based on the interpretation of the specification.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: Flat Modelica
You mean the sections 5.6.1 - 5.6.3 of the Modelica specification? Those are very terse indeed.
Too bad there isn't one standard though. We have a couple of tools at our institute that work on flat Modelica code, but only on the Dymola flavor. I recently looked at whether we could also use OpenModelica's flavor of Flat Modelica in place, but since OpenModelica breaks arrays and matrices into lots of scalar variables it would be a terrible chore to make it work.
I was a bit puzzled as to why OpenModelica breaks them up this way. With Dymola, it's quite easy to take a Dymola-flavored flat model, replace the dots in the variable names, and re-insert the code into any Modelica tool where it will, again, be a proper Modelica model. With the OpenModelica flavor, it seems a little more involved, since you'd have to piece the matrices back together. Or replace the brackets as well, but then you'd get a totally scalarized Modelica model which, to me, seems not nearly as useful (for any purpose outside C-code generation) as one that keeps the basic data structures intact?
Regards,
David
Re: Flat Modelica
We're working on a new flattening phase in OpenModelica that will not break arrays.
Hopefully this will be available in the next months.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: Flat Modelica
My coworkers will be delighted to hear that!
So you know, if OpenModelica's flavor of flat would then be similar to Dymola's flavor of flat code? Or are there other differences between the tools? (Thoroughness of substitution in loop indices, etc)
- Index
- » Programming
- » Modelica Language
- » Flat Modelica