Create curve in modelica
Curve
is not a function. It is a class that is looked up and it is instantiated with the name FScurve
.
There is no top-level Curve
available as default in Modelica. So I would say the example in your book either defined Curve
somewhere or it simply assumes that a class Curve
exists.
Due to the way Name lookup is performed in Modelica, Curve
could be in the same package as the model Spring
or anywhere in the path up to the top level.
Example 1: Two curves, one local
- Curve
- Mechanics
|- Spring
|- Curve // Fscurve refers to this class
Example 2: One curve at top-level
- Curve // Fscurve refers to this class
- Mechanics
|- Spring
|- Foo
Example 3: Two curves, none local
- Curve
- Modelica
|- Curve // Fscurve refers to this class
|- Mechanics
|- Spring
|- Foo
The benefit of that mechanism is, that you can use short class names when you are working inside a package and you don't have to type the full class path (but you always can). If you have e.g. an electrical package
- Electrical
|- Ground
|- Resistor
|- Inductor
|- RL_Circuit
the example RL_Circuit
could look like that:
model RL_Circuit
Ground ground;
Resistor R1;
Electrical.Resistor R2; // refers to the same class as R1, but using its full name
Inductor L1;
equation
connect ...
end RL_Circuit;