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

Graphical text annotation including record parameter

Graphical text annotation including record parameter

Dear all,

I am trying to make a small library for cryogenic thermal analysis purposes. I created a ResistorPowerLaw  model which uses certain parameters from a material  record in the library:

package Material
   extends Modelica.Icons.MaterialPropertiesPackage;
 
   record BaseData       
      extends Modelica.Icons.Record;   
      parameter Real a=1 "Temperature proportionality coefficient";
      parameter Real b=1 "Temperature power coefficient";
   end BaseData;

   record Nb "Niobium"
      extends ThermalCryogenics.Material.BaseData(a=4, b=1);
   end Nb;
….


In OmEdit this is working now (without using the choicesAllMatching statement, the correct full material name + path just needs to be typed in).

However in the diagram view I could not find a way to display which material is selected for the model instance. I would like to include the selected material name (or any of the variables in the material record)  in the graphical annotation of the ResistorPowerLaw instance. For some reason the macro "%material.a" doesn't work (it doesn't display the value, just the literal text, for instance "ThermalCryogenics.Material.Nb().a" when I selected Nb). The variable material.a is however known within the ResistorPowerLaw model (used in the equation section), check model yields no errors and the model runs fine. I don't know how to modify or truncate the displayed string in the graphic annotation.

Any suggestions are welcome!

Re: Graphical text annotation including record parameter

Dear All,

Related to the question below, I would like to ask if anybody knows a work-around to reduce the string displayed in a graphical annotation to just the last part of the complete name. The functionality I am looking for in OMEdit is the following ( copied from ModelicaSpec33.pdf):

%par replaced by the value of the parameter par. The intent is that the text is easily readable, thus if par is of an enumeration type, replace %par by the item name, not by the full name. [Example: if par="Modelica.Blocks.Types.Enumeration.Periodic", then %par should be displayed as "Periodic"]

Any suggestion on how to achieve this in the latest version of OMEdit (v1.11.0) would be most helpful.

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