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

Can't link the existing Modelica Library to a new Custom Library

Can't link the existing Modelica Library to a new Custom Library

I am trying to create a new user library for custom components and wish to use some existing modelica components for the same (like interfaces, SIunits etc.). I am using the extends command in order to import those classes.

eg. extends Modelica.SIunits

I am able to check my package without errors and managed to save the library. Then, I proceed to the graphical editor and drag the components to make a model. But I am not able to connect the components to each other.

The error window shows something like -

Class SIunits.Mass not found in scope of NewLib.NewMass (Where NewLib is my library and NewMass is the custom component made)

I am saving the library created in the /omlibrary folder. I tried placing it in the /omlibrary/modelica folder but then OMEdit is unable to load the modelica package.

Pardon me for my ignorance as I am new user to the modeling and simulation environment. Any help will be very much appreciated.

Thanks

Re: Can't link the existing Modelica Library to a new Custom Library

Note: In OpenModelica, checkModel on a package does very little (it basically checks that any constants defined are OK; it does not check inherited classes as they are unused):

Code:

>>> instantiateModel(Modelica.SIunits)

"class Modelica.SIunits
end Modelica.SIunits;
"

Did you import SIunits in NewMass?

Re: Can't link the existing Modelica Library to a new Custom Library

Ya I was trying to import SIunits and Modelica.Mechanics.Translational.Interfaces into my new library.

I tried using -
package Interfaces = Modelica.Mechanics.Translational.Interfaces 
but to no avail.

How do I link the above Interfaces package so that I am able to use it in my NewLib ?

Thanks a Lot !

Re: Can't link the existing Modelica Library to a new Custom Library

import Modelica.Mechanics.Translational.Interfaces; doesn't work?

Re: Can't link the existing Modelica Library to a new Custom Library

import Modelica.Mechanics.Translational.Interfaces did work!!

I am still not able to figure out what I was doing earlier that made the model unable to simulate. I feel stupid now! 

Anyways Thanks a Lot! current/smile

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