- Index
- » Programming
- » Modelica Language
- » List of variables for class
List of variables for class
List of variables for class
Hello OME users,
When I use sub-model (class.mo) in another model (for example class can be DC motor and second model contain power supply and this class of DC motor) can I make a list of variables for this class in primary model? It means, when I double-click on the DC motor class to open list with parameters. I’m wondering if is possible in OME? Now I have to expand class (“show class”) and to type the values of every component.
Thanks for Your help.
Cheers,
Lala : )
- Lala
- 32 Posts
Re: List of variables for class
I think that the solution is to make a new record for model.
I made a record, but the problem is that my class doesn’t recognize the parameters from the record. For example when I put this code into the record file, my model wouldn’t find it:
Code:
record AIMC_record
parameter Modelica.SIunits.Inertia Jr = 0.29 "Rotor's moment of inertia";
annotation…
end AIMC_record;
Anyone who worked with this? Any tips?
Thanks a lot,
Lala : )
- Lala
- 32 Posts
Re: List of variables for class
P.S. Name of the class is aimc_class.mo
- Lala
- 32 Posts
Re: List of variables for class
I already found a solution how to solve this task. But maybe some new users will have the same problem, so that’s why I will try to explain that in this section.
In the very beginning of the class formulation, just define the parametres that You are going to use in the class. Definition will look something like this (this is for inspiration only):
Code:
final parameter Integer m = 3 "Some number";
parameter Modelica.SIunits.Inertia Jr = 0.29 "Inertia";
parameter Integer p(min = 1) = 2 "Number of pole pairs";
parameter Modelica.SIunits.Frequency fsNominal = 50 "Frequency";
parameter Modelica.SIunits.Inductance Lm = 0.00922531 "Inductance" annotation(Dialog(tab = "New tab"));
I think that You are going to understand this code when You use it. Variables are defined trough path Modelica/SIunits. Section “annotation(Dialog(tab = "New tab"));” defines the new tab (not “General” tab) for the model.
I hope so that this will help to someone.
Cheers,
Lala : )
- Lala
- 32 Posts
- Index
- » Programming
- » Modelica Language
- » List of variables for class