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

OMC Command to add constants/parameters/variables

OMC Command to add constants/parameters/variables

Hello,

I am trying to use the OMC to generate Modelica code. I am very familiar with the OMC and its API. However, the only way I have found of adding a parameter under a given model or package is to use the following Command string:

"package x  parameter Real a; parameter Real b; end x;"

However, this method is very problematic as it requires that all the code listing be inserted.

Is there a better way? Something like addParameter(ParentClass, parameterName)?

Thanks

C. Adourian

Re: OMC Command to add constants/parameters/variables

Hi,

use addComponent() and updateComponent().

See here:
https://trac.openmodelica.org/OpenModel … aAPI-Howto
Also in the testsuite here:
https://trac.openmodelica.org/OpenModel … active-API

Cheers,
Adrian Pop/

Re: OMC Command to add constants/parameters/variables

Hi Everyone,

I have a question regarding compiling a model from cmd using OMC command. It seems like it takes more time to compile and simulate the model using OMC. I just wanted to ask if anyone knows the parameters affecting the time that it takes to compile the model. I increased the number of the elements in my model and it takes approximately the same time to be compiled. So, I was wondering what parameters of the model affect the time consumption for simulation.


Thanks for your attention,
Pouya

There are 0 guests and 0 other users also viewing this topic
You are here: