Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Diagram/Icon View in Eclipse(ModelicaML)

Diagram/Icon View in Eclipse(ModelicaML)

Hi,
I am working on Modelica and UML on Eclipse and am trying to make Icons and Diagrams for my models using annotations from modelicaML. I need help in viewing the Diagram/Icon view in Eclipse from the annoatations.

I am using Eclipse Kepler with MDT and ModelicaML.

Thank you.

Re: Diagram/Icon View in Eclipse(ModelicaML)

Try opening OMEdit and see which commands it executes in order to query the icon information (Tools->OMC CLI).

Re: Diagram/Icon View in Eclipse(ModelicaML)

I tried that. The command I found related to this was getIconAnnotation(<modelname>) I tried that with omc inside Eclipse and it just returned the Icon Annotation.

Has someone tried to get the Icon/Diagram View while using Eclipse with MDT/ModelicaML before?

Re: Diagram/Icon View in Eclipse(ModelicaML)

Yes, getting the icon annotation is how you draw the icon current/smile

You can also see https://github.com/OpenModelica/OMCompi … e_icons.py which requires OMPython installed to generate SVG icons.

Re: Diagram/Icon View in Eclipse(ModelicaML)

@sjoelund.se. Thank you for the prompt replies. Is OMPython the only way to do it? I don't know python..
If that's the only way, I'll learn Python. But also, how do you use OMPython with Eclipse?

Re: Diagram/Icon View in Eclipse(ModelicaML)

All it does is call OpenModelica via CORBA. There are some maps in there and other data types that should be available in Java as well. OMEdit does it all in C++.

Re: Diagram/Icon View in Eclipse(ModelicaML)

Basically you need a lot more than getIconAnnotation.

You need to check the inherited classes recursively. You need to get the components of the class and then icon annotation of each component class.

For example if you want to draw the icon for a Resistor component you need the following commands.

Code:

getInheritedClasses(Modelica.Electrical.Analog.Basic.Resistor)

{Modelica.Electrical.Analog.Interfaces.OnePort,Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort}

getInheritedClasses(Modelica.Electrical.Analog.Interfaces.OnePort)
{}

getIconAnnotation(Modelica.Electrical.Analog.Interfaces.OnePort)
{}

getComponents(Modelica.Electrical.Analog.Interfaces.OnePort, useQuotes = true)
{{"Modelica.SIunits.Voltage","v","Voltage drop between the two pins (= p.v - n.v)", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.SIunits.Current","i","Current flowing from pin p to pin n", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.Electrical.Analog.Interfaces.PositivePin","p","Positive pin (potential p.v > n.v for positive voltage drop v)", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.Electrical.Analog.Interfaces.NegativePin","n","Negative pin", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"}}

getComponentAnnotations(Modelica.Electrical.Analog.Interfaces.OnePort)
{{},{},{Placement(true,-,-,-110.0,-10.0,-90.0,10.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,110.0,-10.0,90.0,10.0,-,-,-,-,-,-,-,)}}

getInheritedClasses(Modelica.Electrical.Analog.Interfaces.PositivePin)
{}

getIconAnnotation(Modelica.Electrical.Analog.Interfaces.PositivePin)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}

getComponents(Modelica.Electrical.Analog.Interfaces.PositivePin, useQuotes = true)
{{"Modelica.SIunits.Voltage","v","Potential at the pin", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.SIunits.Current","i","Current flowing into the pin", "public", "false", "true", "false", "false", "unspecified", "none", "unspecified","{}"}}

getComponentAnnotations(Modelica.Electrical.Analog.Interfaces.PositivePin)
{{unassignedMessage="An electrical potential cannot be uniquely calculated.
The reason could be that
- a ground object is missing (Modelica.Electrical.Analog.Basic.Ground)
  to define the zero potential of the electrical circuit, or
- a connector of an electrical component is not connected."},{unassignedMessage="An electrical current cannot be uniquely calculated.
The reason could be that
- a ground object is missing (Modelica.Electrical.Analog.Basic.Ground)
  to define the zero potential of the electrical circuit, or
- a connector of an electrical component is not connected."}}

getDiagramAnnotation(Modelica.Electrical.Analog.Interfaces.PositivePin)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-40, 40}, {40, -40}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-160, 110}, {40, 50}}, "%name", 0, TextAlignment.Center)}}

getInheritedClasses(Modelica.Electrical.Analog.Interfaces.NegativePin)
{}

getIconAnnotation(Modelica.Electrical.Analog.Interfaces.NegativePin)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}

getComponents(Modelica.Electrical.Analog.Interfaces.NegativePin, useQuotes = true)
{{"Modelica.SIunits.Voltage","v","Potential at the pin", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.SIunits.Current","i","Current flowing into the pin", "public", "false", "true", "false", "false", "unspecified", "none", "unspecified","{}"}}

getComponentAnnotations(Modelica.Electrical.Analog.Interfaces.NegativePin)
{{unassignedMessage="An electrical potential cannot be uniquely calculated.
The reason could be that
- a ground object is missing (Modelica.Electrical.Analog.Basic.Ground)
  to define the zero potential of the electrical circuit, or
- a connector of an electrical component is not connected."},{unassignedMessage="An electrical current cannot be uniquely calculated.
The reason could be that
- a ground object is missing (Modelica.Electrical.Analog.Basic.Ground)
  to define the zero potential of the electrical circuit, or
- a connector of an electrical component is not connected."}}

getDiagramAnnotation(Modelica.Electrical.Analog.Interfaces.NegativePin)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-40, 40}, {40, -40}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-40, 110}, {160, 50}}, "%name", 0, TextAlignment.Center)}}

getInheritedClasses(Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort)
{}

getIconAnnotation(Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort)
{}

getComponents(Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort, useQuotes = true)
{{"Boolean","useHeatPort","=true, if heatPort is enabled", "public", "false", "false", "false", "false", "parameter", "none", "unspecified","{}"},{"Modelica.SIunits.Temperature","T","Fixed device temperature if useHeatPort = false", "public", "false", "false", "false", "false", "parameter", "none", "unspecified","{}"},{"Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a","heatPort","Conditional heat port", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.SIunits.Power","LossPower","Loss power leaving component via heatPort", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.SIunits.Temperature","T_heatPort","Temperature of heatPort", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"}}

getComponentAnnotations(Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort)
{{Evaluate=true, HideResult=true, choices(error)},{Dialog("General","",true,-,false,"","","","","",false)},{Placement(true,-,-,-10.0,-110.0,10.0,-90.0,-,-,-,-10.0,-110.0,10.0,-90.0,)},{},{}}

getInheritedClasses(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a)
{Modelica.Thermal.HeatTransfer.Interfaces.HeatPort}

getInheritedClasses(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort)
{}

getIconAnnotation(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort)
{}

getComponents(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort, useQuotes = true)
{{"Modelica.SIunits.Temperature","T","Port temperature", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"},{"Modelica.SIunits.HeatFlowRate","Q_flow","Heat flow rate (positive if flowing from outside into the component)", "public", "false", "true", "false", "false", "unspecified", "none", "unspecified","{}"}}

getComponentAnnotations(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort)
{{},{}}

getIconAnnotation(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {191, 0, 0}, {191, 0, 0}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}

getComponents(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a, useQuotes = true)
{}

getDiagramAnnotation(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort)
{}

getInheritedClasses(Modelica.SIunits.Temperature)
{Modelica.SIunits.ThermodynamicTemperature}

getInheritedClasses(Modelica.SIunits.ThermodynamicTemperature)
{Real}

errors:=getMessagesStringInternal()
{}

size(errors,1)
0

getIconAnnotation(Modelica.SIunits.ThermodynamicTemperature)
{}

getComponents(Modelica.SIunits.ThermodynamicTemperature, useQuotes = true)
{}

getIconAnnotation(Modelica.SIunits.Temperature)
{}

getComponents(Modelica.SIunits.Temperature, useQuotes = true)
{}

getDiagramAnnotation(Modelica.SIunits.ThermodynamicTemperature)
{}

getDiagramAnnotation(Modelica.SIunits.Temperature)
{}

getInheritedClasses(Modelica.SIunits.HeatFlowRate)
{Real}

getIconAnnotation(Modelica.SIunits.HeatFlowRate)
{}

getComponents(Modelica.SIunits.HeatFlowRate, useQuotes = true)
{}

getDiagramAnnotation(Modelica.SIunits.HeatFlowRate)
{}

getDiagramAnnotation(Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {191, 0, 0}, {191, 0, 0}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-50, 50}, {50, -50}}, 0), Text(true, {0.0, 0.0}, 0, {191, 0, 0}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-120, 120}, {100, 60}}, "%name", 0, TextAlignment.Center)}}

getIconAnnotation(Modelica.Electrical.Analog.Basic.Resistor)
{-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-70, 30}, {70, -30}}, 0), Line(true, {0.0, 0.0}, 0, {{-90, 0}, {-70, 0}}, {0, 0, 255}, LinePattern.Solid, 0.25, {Arrow.None, Arrow.None}, 3, Smooth.None), Line(true, {0.0, 0.0}, 0, {{70, 0}, {90, 0}}, {0, 0, 255}, LinePattern.Solid, 0.25, {Arrow.None, Arrow.None}, 3, Smooth.None), Text(true, {0.0, 0.0}, 0, {0, 0, 0}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-144, -40}, {142, -72}}, "R=%R", 0, TextAlignment.Center), Line(false, {0.0, 0.0}, 0, {{0, -100}, {0, -30}}, {127, 0, 0}, LinePattern.Dot, 0.25, {Arrow.None, Arrow.None}, 3, Smooth.None), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-152, 87}, {148, 47}}, "%name", 0, TextAlignment.Center)}}

getComponents(Modelica.Electrical.Analog.Basic.Resistor, useQuotes = true)
{{"Modelica.SIunits.Resistance","R","Resistance at temperature T_ref", "public", "false", "false", "false", "false", "parameter", "none", "unspecified","{}"},{"Modelica.SIunits.Temperature","T_ref","Reference temperature", "public", "false", "false", "false", "false", "parameter", "none", "unspecified","{}"},{"Modelica.SIunits.LinearTemperatureCoefficient","alpha","Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))", "public", "false", "false", "false", "false", "parameter", "none", "unspecified","{}"},{"Modelica.SIunits.Resistance","R_actual","Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified","{}"}}

getComponentAnnotations(Modelica.Electrical.Analog.Basic.Resistor)
{{},{},{},{}}

Re: Diagram/Icon View in Eclipse(ModelicaML)

@sjoelund.se could you guide me in using that Python code from Git that you pointed to? I haven't used COBRA plugin before.

@adeas we are going to use customized diagrams for our model so I think we will just need Eclipse to understand Libraries of Shapes, text, and coordinate axes. Thank you for your input.

Is Eclipse with MDT meant to be able to replace OMEdit? I appreciate the Syntax checking and Library access feature in Eclipse which are not available in OMEdit but I also need Icon/Diagram View for our project.

Re: Diagram/Icon View in Eclipse(ModelicaML)

MDT itself is using CORBA to do all operations, but it is not supposed to replace OMEdit. OMEdit is designed to replace MDT.

There are 0 guests and 0 other users also viewing this topic
You are here: