Forgot password? | Forgot username? | Register

My own Library

My own Library

Hi everyone,
I'm trying to solve some exercise from … ca-courses and right now I'm doing Lecture 4 - Connectors.
If you scroll down to slide number 24 there is a code to make Hierarchically Structured Components.
I just copy and paste all the code and OpenModelica show me the error messages below:

[1] 12:10:10 Translation Errore
[PartialDCMotor2: 2:1-2:15]: Class Inport not found in scope PartialDCMotor2.

[2] 12:10:10 Translation Errore
Error occurred while flattening model PartialDCMotor2

How can I create my own library?

Thanks for your help,

Administrator has disabled public posting. Please login or register in order to proceed.

Re: My own Library

A very important feature in order to build reusable descriptions is to define and reuse partial models. For Example A common property of many electrical components is that they have two pins. This means that it is useful to define an interface model class TwoPin, which has two pins, p and
n, and a quantity, v, which defines the voltage drop across the component.

partial model TwoPin
Pin p, n;
Voltage v;
v = p.v - n.v; p.i + n.i = 0;
end TwoPin;

The equations define common relations between quantities of a simple electrical component.
The keyword partial indicates that the model class is incomplete. To be useful, a constitutive equation must be added. To define a model for a resistor, start from TwoPin and add a parameter for the resistance and Ohm’s law to define the behavior.

model Resistor "Ideal resistor"
extends TwoPin;
parameter Resistance R;
R*p.i = v;
end Resistor;

A string between the name of a class and its body is treated as a comment attribute and is
intended to describe the class. Tools may display this documentation in special ways. The
keyword parameter specifies that the quantity is constant during a simulation experiment,
but can change values between experiments.

Edited by: claudio34 - Dec-09-15 14:59:59
Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic