In Modelica/Dymola you can inherit from another class by using extend
:
extends Modelica.Magnetic.FluxTubes.BaseClasses.Force(dlBydx=-1);
This will extend from the Force
class but overwrites the default parameter dlBydx
with -1
.
Now the question: most classes also contain a documentation and an icon (that is e.g. used in Dymola's graphics view). Is it possible to extend from a class but ignore the documentation section including the icon so it can be overwritten in the new class?
I try to give a reduced (and thus non-sense) but complete example...
model Force "Base class"
parameter Integer dlBydx=1;
equation
F_m = dlBydx * 0.5;
annotation (Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}}), graphics={
Rectangle(
extent={{30,30},{70,-30}},
lineColor={255,128,0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(points={{-70,0},{-90,0}}, color={255,128,0})}), Documentation(info="<html>
<p>
This is the documentation of the base class.
</p>
</html>"));
end Force;
model Force_New "Derivated class"
extends Force(Icon()); //here I want to extend from Force with an empty icon in the new model but this line gives an error of course!
end Force_New;
So you would like to extend a base-class without the icon and documentation:
annotation (IconMap(primitivesVisible=false))
. For you this would result in:
model Force_New "Derivated class without icon"
extends Force annotation(IconMap(primitivesVisible=false));
end Force_New;