Search code examples
modelicadymola

How to set the visual size of one component based on another component in the same type?


I am using Dymola. Assuming that I have two components in my model, I want to use the same visual size for the components that share the same type.

So how could I set the visual size of one component according to another one? I am not planning to use annotation code, cause that could be too much trouble when there are many components?

enter image description here


Solution

  • I think using annotations will be the only way to go. This is where the position and size of a component are determined. The only way that comes to my mind is using parameters to set these positions as (partially) shown below.

    model pos_params
      parameter Real pos_x1 = -10;
    
      Modelica.Blocks.Sources.Constant const annotation (Placement(transformation(extent={{pos_x1,-10},{10,10}})));
    end pos_params;
    

    To get to your result you would need to have some additional parameters in multiple components.

    Still, doing this in Dymola will make make the graphical manipulation of size an position of a model cumbersome, as the icon will be set to have zero size.