Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » TimS
  • » Profile

Posts

Posts

Hi,
thanks for your fast reply.
I get the seg dump in this template function getAnnotations. Without the listLength functioncall the model compiles just fine.
The idea was to get  the number of submodels.

template getAnnotations(SCode.ClassDef  cd)::=
match cd
case PARTS(__) then <<    <%listLength(elementLst)%> >>
...
end getAnnotations;


I will have a closer look at the Dump class but i still have problems understanding the relation between the modules.
Absyn contains all the data structure of a translated modelica model and SCode includes a more readable version. And SimCode just contains snippets sorted by their membership( e.g. all linear equation in one list)?
Can i use the dumpProgram function in the SCode structure as well for printing the AST?
And how can in import the Dump.mo in my Template? Is this possible at all ?

Greeting
Tim

Hello everyone,

100th thread current/smile

I am writing a new Template for Codegeneration and i have a Question about the omc datastructure.
I am able to abstract the name of vars, functions , etc and annotations from a single model in a single file like:

model test1
Real x(start=1);
equation
der(x)= -x;
end test1;



I would like to be able to access more models which resists one file like the model below and to be able to get
,for example, for  each submodel the name and annotation info.



model test2

model test21 "test 22" annotation(/.../);   
    Real y(start = 1);
    equation
    der( y)=y *34;
end test21;

model test22 "test 22 "annotation(/.../);
    Real z(start=5.0);
    equation
    der(z) = - z
end test22;


end test2;


I thought the PARTS record within the ClassDef uniontype holds all the information i need. But all the lists of parts are not accessable, or rather  get a segmentation dump.
Does anyone know which datastructure in  i have to acess?

Kind regarts,
TIm

  • Index
  • » Users
  • » TimS
  • » Profile
You are here: