Skip to content

Annotations associated with physical units  #22

@AtiyahElsheikh

Description

@AtiyahElsheikh

Physical units in BioChem are currently declared with annotations, e.g.

type Concentration= Real(quantity="Concentration", unit="mol/l", min=0)              
          annotation(Icon(coordinateSystem(extent={{-100,100},{100,-100}}, preserveAspectRatio=true, grid={10,10})),
                     Diagram(coordinateSystem(extent={{-100,100},{100,-100}}, preserveAspectRatio=true, grid={10,10})));

It resembles somehow Modelica.Icons.TypeReal:

type TypeReal "Icon for Real types"
    extends Real;
    annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
          Rectangle(
            lineColor={160,160,164},
            fillColor={160,160,164},
            fillPattern=FillPattern.Solid,
            extent={{-100.0,-100.0},{100.0,100.0}},
            radius=25.0),
          Text(
            textColor={255,255,255},
            extent={{-90.0,-50.0},{90.0,50.0}},
            textString="R")}),Documentation(info="<html>
<p>
This icon is designed for a <strong>Real</strong> type.
</p>
</html>"));
end TypeReal;

I would rather prefer to get rid of the annotations and make use of TypeReal, something like that:

 type Concentration = Modelica.Icons.TypeReal(final quantity="Concentration",final unit = "mol/l", min = 0)
  " Concentration of a metabolite [mol/l]";

Questions:

  • Is there any need to keep the old annotations,
    • the preserveAspectRatio attribute of Icon? its value is true in BioChem and false in TypeReal
    • the Diagram annotation?
  • The Icon will appear with the string "R". Can annotations in subclasses get modified? so that the attribute textString in TypeReal get overwritten by the unit attribute of type Real?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions