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

Variables in connector

Variables in connector

Hello,
I am very new to Modelica / OpenModelica. Is there any possibility to list the variables and their types in the connector of a block? How could I find out using OpenModelica Scripting API commands?
E.g. in the p pin and the n pin of a resistor there are the variable voltage v and the flow variable i for the current.

Re: Variables in connector

Yes you can query them using the scripting API,

Code:


loadModel(Modelica);
getComponents(Modelica.Electrical.Analog.Interfaces.PositivePin);
getComponents(Modelica.Electrical.Analog.Interfaces.NegativePin);

Adeel.

Re: Variables in connector

Thank you very much!!
It seems the function is not documented in the Scripting API documentation. Could you provide me some sort of documentation? Is it nearly the same as the getComponentsTest function? Thanks in advance!!
Hendrik

Edited by: Hendrik - Sep-10-19 12:27:22

Re: Variables in connector

Yeah some of the functions are not documented yet.

getComponents takes a model name as input

It returns the list of components where each component is like this record,

Code:


record Component
  String className;
  String name;
  String comment;
  String access;
  Boolean isFinal;
  Boolean isFlow;
  Boolean isStream;
  Boolean isReplaceable;
  String variability "'constant', 'parameter', 'discrete', 'unspecified'";
  String innerOuter "'inner', 'outer', 'none'";
  String inputOutput "'input', 'output', 'unspecified'";
  String dimensions[:];
end Component;

Adeel.

Re: Variables in connector

Thank you so much!!
Greetings Hendrik

There are 0 guests and 0 other users also viewing this topic