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

Class is not found in Scope

Class is not found in Scope

Hi,
I am a new user trying to use OpenModelica. I am trying to create a custom component in OMEdit. For eg. I want to create a new component called Mass2 in the Mechanics.Translational.Components Package. I am unable to do so. I use the standard interfaces that are present in order to complete the component(or model).
I try to run it and it gives me errors saying
" Class SI.Mass is not found in scope Mass2 "

I am confused and when I try loading the modelica library in OMEdit by typing "loadModel(Modelica)", it gives an error. 

Any help in this regard would be very much appreciated.
Thank You

Re: Class is not found in Scope

You shouldn't try to add components to the standard library. You need to create your own library to insert classes into.

Re: Class is not found in Scope

Thank you for your prompt reply.
Pardon my ignorance but is creating a new library same as defining a new package ?
Also, once created, can the new library incorporate components, interfaces from the modelica standard library or will I have to redefine them again ?

Thanks

Re: Class is not found in Scope

All libraries are packages but not all packages are libraries. But yes, basically the same thing (just how you load them is different).

You can use something like:

Code:

import Modelica.Mechanics.Translational.Interfaces;

Interfaces.XXX xxx;

And keep using the standard interfaces. And the standard components, and so on. You only need to redefine them if you want a different kind of connector.

Re: Class is not found in Scope

Helle,
I'm brand new on open Modelica and have the same problem that I cannot solve. Maybe
I try to duplicate a Modelica Model (Modelica.Fluid.Sources.BaseClasses.PartialFlowSource) because I want to use this as a basis and add some additionnal equations.
I created the model (MAssFlowQT), andmodified the initial model importing the packages necessary to use it like this
import Modelica.Media.Interfaces.Choices.IndependentVariables;
import Modelica.Fluid.Sources.BaseClasses.PartialFlowSource;

However now I have an error  (Class Medium.MassFlowRate not found in scope MAssFlowQT) .
I don't know what I have to do (import other classes?) because I cannot find Class.Medium.MassFlowrate...

I'm sure I do a big mistake but can't understand why.

If someone knows about It It would be great. Thanks

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