- Index
- » Users
- » AntoineR
- » Profile
Posts
Posts
Ok, well noted.
I have opened the issue #8094 in GitHub and I provide a model with the complete associated package that allows to reproduce the error.
Hello folks,
using a library with nested expandable connectors and buses, with some models I experience an error which is difficult to overcome, using the v1.18.0 OME:
Code:
Error Buffer:
[C:/OM118/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFConnection.mo:57:7-58:91:writable] Error: Internal error NFConnection.split got unbalanced connection connect(SpeedController.mainBus, mainBus) (lhs: 14, rhs: 15)
I understand lhs = left hand side ( ie SpeedController.mainBus) and rhs = right hand side (mainBus).
I understand the left side has 14 variables/connectors and the righ side has 15 ones, thus 1 is missing thus the "unballanced".
However, I aldready used such buses altogether in the same configuration or different configurations without error.
The mentionned model runs without warning nor error in Dymola 2021, which lead me to question if there is an issue with the OpenModelica checking NFConnection.split.
my question:
- is there any means to display the lhs and rhs variables/connectors in the error message, so that I can undertand what is wrong ?
I'm looking for any advice on a way to find the origin of such issues.
Antoine
It seems to be a bug.
Ticket #7717 has been opened.
Thanks Perost, well noted.
Hello,
with the following model below, OpenModelica generates an error. It seems that OpenModelica is not compliant with modelia language 3.5 with regards to array of records with variable length content (chapter 10):
« An array of records may contain scalar record values whose elements differ in their dimension sizes, but apart from that they must be of the same type. »
The example below defines a record with an array inside.
then, the model «oo» instantiates 2 records with arrays of different sizes. Then these records are grouped into an array of record.
depending on the order of instantiation, the flattener throw out an error or not. When it does not generates an error, the flattened code is wrong.
is it so that OpenModelica is not implementing modelica language v3.5 for this specific part ? Or did I missinterpet the language spec ?
Code:
package test
//record definition
record rec
Real[:,:] tab = fill(0.0,2,2) ;
end rec;
// model
model oo
// define 2 tables with different sizes
parameter Real[:,:] tab1 = [0,0 ; 1,1] ;
parameter Real[:,:] tab2 = [5,5,5,5 ; 6,6,6,6 ; 7,7,7,7 ; 8,8,8,8] ;
// set records
parameter rec r1(tab = tab1);
parameter rec r2(tab = tab2);
//define vector of records
parameter rec[2] alpha = {r1, r2};
parameter rec[2] beta = {r2, r1};
end oo;
end test;
I found a workaround, but still remains the issue.
workaround is:
Code:
Integer bool[size(alpha,1)] ={(if alpha[i].value ==check then 1 else 0) for i in 1:size(alpha,1)} ;
Still, anyone has clue on what is wrong in the first piece of code below ?
Code:
Integer[size(alpha,1)] bool={(if i.value == check then 1 else 0) for i in alpha};
Hello,
with the following piece of code (see below), OpenModelica throw out an error : «tu.mo:22:3-22:71:writable] Error: Variable i.value not found in scope oo. »
It is not clear to me why such an error for line of definition of variable «bool». Did I miss some rules in the modelica langage that prohibits such declaration ?
I'm using OpenModelica v1.17.0 / OMSimulator v2.0.0.post284-gc8ec782-mingw.
For reference, the piece of code below checks, compiles and runs under Dymola 2021.
Code:
package test
//simple enumeration
type t = enumeration( a, b, c, d);
//simple record that contain an enumeration
record rec
parameter t value = t.a;
end rec;
// model
model oo
// fill 2 records
rec r1(value=t.a);
rec r2(value=t.b);
//define vector of records
parameter rec alpha[2]={r1, r2};
parameter t check=t.b ;
// define vector «bool» which contains 1 or 0 depending on «check» value and content of vector «alpha»
Integer[size(alpha,1)] bool={(if i.value == check then 1 else 0) for i in alpha};
end oo;
end test;
check. thanks Perost.
Perost, my goal is to check all models including nested models. The message states «Error», which I understand «something is wrong in the code». I would understand a «warning» message instead rather than «error».
Hello,
I'm reproducing the simple example of Modelica Specification 3.4, given in section 5.4 «Instance Hierarchy Name Lookup of Inner Declarations», adding few dummy equations to have it ballanced:
Code:
model simple
class A
outer Real T0;
Real u ;
equation
u=T0 ;
end A;
class B
inner Real T0;
A a1, a2; // B.T0, B.a1.T0 and B.a2.T0 is the same variable
equation
T0= 45;
end B;
end simple;
checking the whole thing under OpenModelica [1.17.0] leads to the following error for test of class A:
Error Buffer:
[simple:3:4-3:17:writable] Error: The model can't be instantiated due to top-level outer component ‘T0‘, it may only be used as part of a simulation model.
[simple:3:4-3:17:writable] Warning: An inner declaration for outer component T0 could not be found and was automatically generated.
The flat model seems however correct and compiles and run OK. Model tests Ok in Dymola [2021].
it is not clear to me why the simple model from the Modelica Specification generates an error in the checking. Is it me doing it the wrong way ?
- Index
- » Users
- » AntoineR
- » Profile