Hello Ankit,
Thank you very much for your reply and the example. I appreciate it.
Below there's a modified version of the example, illustrating the situation I refer to. I added another component to the interior model (i.e. inputOutputInterior1.power2
) and connected it to the expandable connectors. In order to make it work, in the exterior model I had to add one input and one output in accordance to those changes.
What I want to avoid is having to explicitly write in the exterior model all the inputs and outputs corresponding to the signals in the interior model. In very simple cases this is not too cumbersome, but some of the models I'll use will have at least 10 signals, and I'll need several instances of them.
I tried modifying the example defining an expandable input connector rather than a simple expandable connector, but inside signals don't seem to be accessible this way.
I guess another option would be to use an array of input connectors in the exterior model, but this would not keep the names of the signals in the input models, which are physically meaningful for the final user.
Any additional suggestion would be highly appreciated.
Cheers,
Fabián
package BusExample
model InputOutputExterior
Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {-88.068, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput y1 annotation(Placement(visible = true, transformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
InputOutputInterior inputOutputInterior1 annotation(Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
MyBus myBus2 annotation(Placement(visible = true, transformation(origin = {32.152, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {32.152, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
MyBus myBus1 annotation(Placement(visible = true, transformation(origin = {-40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-40, -3.844}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput u2 annotation(Placement(visible = true, transformation(origin = {-76.731, 51.632}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-76.731, 51.632}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput y2 annotation(Placement(visible = true, transformation(origin = {77.448, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {77.448, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(myBus2, inputOutputInterior1.myBus2) annotation(Line(visible = true, origin = {21.076, 0}, points = {{11.076, 0}, {-11.076, 0}}, color = {64, 64, 64}));
connect(myBus1, inputOutputInterior1.myBus1) annotation(Line(visible = true, origin = {-25, 0}, points = {{-15, 0}, {15, 0}}, color = {64, 64, 64}));
connect(u2, myBus1.u2) annotation(Line(visible = true, origin = {-52.244, 34.421}, points = {{-24.487, 17.211}, {12.244, 17.211}, {12.244, -34.421}}, color = {0, 0, 127}));
connect(u1, myBus1.u1) annotation(Line(visible = true, origin = {-64.034, 0}, points = {{-24.034, 0}, {24.034, 0}}, color = {0, 0, 127}));
connect(myBus2.y1, y1) annotation(Line(visible = true, origin = {56.076, 0}, points = {{-23.924, 0}, {23.924, 0}}, color = {64, 64, 64}));
connect(myBus2.y2, y2) annotation(Line(visible = true, origin = {42.4, 25}, points = {{-10.248, -25}, {-12.4, -25}, {-12.4, 25}, {35.048, 25}}, color = {64, 64, 64}));
annotation(__Wolfram(ControlPanels(Panel(identifier = "clever-gauss", title = "Untitled", elements = {Slider(variable = u, min = 0, max = 10)}))), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, origin = {-98.801, 23.915}, fillColor = {255, 255, 255}, extent = {{-1.199, -0.972}, {1.199, 0.972}}), Rectangle(visible = true, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}})}));
end InputOutputExterior;
model InputOutputInterior
Modelica.Blocks.Math.Power power1 annotation(Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
MyBus myBus1 annotation(Placement(visible = true, transformation(origin = {-70, -0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-45.752, -45.752}, {45.752, 45.752}}, rotation = -90)));
MyBus myBus2 annotation(Placement(visible = true, transformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {100, -0}, extent = {{-43.792, -43.792}, {43.792, 43.792}}, rotation = -90)));
Modelica.Blocks.Math.Power power2 annotation(Placement(visible = true, transformation(origin = {0, 47.217}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(power2.u, myBus1.u2) annotation(Line(visible = true, origin = {-50.667, 31.478}, points = {{38.667, 15.739}, {-19.333, 15.739}, {-19.333, -31.478}}, color = {0, 0, 127}));
connect(power2.y, myBus2.y2) annotation(Line(visible = true, origin = {57, 31.478}, points = {{-46, 15.739}, {23, 15.739}, {23, -31.478}}, color = {0, 0, 127}));
connect(power1.y, myBus2.y1) annotation(Line(visible = true, origin = {45.5, 0}, points = {{-34.5, 0}, {34.5, 0}}, color = {0, 0, 127}));
connect(power1.u, myBus1.u1) annotation(Line(visible = true, origin = {-41, 0}, points = {{29, 0}, {-29, 0}}, color = {0, 0, 127}));
annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}})}));
end InputOutputInterior;
expandable connector MyBus
annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Polygon(visible = true, lineColor = {64, 64, 64}, fillColor = {255, 215, 136}, fillPattern = FillPattern.Solid, points = {{-40, 25}, {-25, 25}, {25, 25}, {40, 25}, {50, 15}, {45, -5}, {40, -20}, {30, -25}, {20, -25}, {-20, -25}, {-30, -25}, {-40, -20}, {-45, -5}, {-50, 15}}, smooth = Smooth.Bezier), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{-32.5, 7.5}, {-27.5, 12.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{-2.5, 7.5}, {2.5, 12.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{27.5, 7.5}, {32.5, 12.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{-17.5, -12.5}, {-12.5, -7.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{12.5, -12.5}, {17.5, -7.5}})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Text(visible = true, origin = {0, 16.667}, textColor = {64, 64, 64}, extent = {{-160, 33.333}, {40, 73.333}}, textString = "%name"), Polygon(visible = true, lineColor = {64, 64, 64}, fillColor = {255, 215, 136}, fillPattern = FillPattern.Solid, points = {{-40, 25}, {-25, 25}, {25, 25}, {40, 25}, {50, 15}, {45, -5}, {40, -20}, {30, -25}, {20, -25}, {-20, -25}, {-30, -25}, {-40, -20}, {-45, -5}, {-50, 15}}, smooth = Smooth.Bezier), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{-32.5, 7.5}, {-27.5, 12.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{-2.5, 7.5}, {2.5, 12.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{27.5, 7.5}, {32.5, 12.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{-17.5, -12.5}, {-12.5, -7.5}}), Ellipse(visible = true, lineColor = {64, 64, 64}, fillColor = {64, 64, 64}, fillPattern = FillPattern.Solid, extent = {{12.5, -12.5}, {17.5, -7.5}})}));
end MyBus;
annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Polygon(visible = true, origin = {0.248, 0.044}, lineColor = {56, 56, 56}, fillColor = {128, 202, 255}, fillPattern = FillPattern.Solid, points = {{99.752, 100}, {99.752, 59.956}, {99.752, -50}, {100, -100}, {49.752, -100}, {-19.752, -100.044}, {-100.248, -100}, {-100.248, -50}, {-90.248, 29.956}, {-90.248, 79.956}, {-40.248, 79.956}, {-20.138, 79.813}, {-0.248, 79.956}, {19.752, 99.956}, {39.752, 99.956}, {59.752, 99.956}}, smooth = Smooth.Bezier), Polygon(visible = true, origin = {0, -13.079}, lineColor = {192, 192, 192}, fillColor = {255, 255, 255}, pattern = LinePattern.None, fillPattern = FillPattern.HorizontalCylinder, points = {{100, -86.921}, {50, -86.921}, {-50, -86.921}, {-100, -86.921}, {-100, -36.921}, {-100, 53.079}, {-100, 103.079}, {-50, 103.079}, {0, 103.079}, {20, 83.079}, {50, 83.079}, {100, 83.079}, {100, 33.079}, {100, -36.921}}, smooth = Smooth.Bezier), Rectangle(visible = true, origin = {0, -5}, lineColor = {198, 198, 198}, fillColor = {238, 238, 238}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-100, -25}, {100, 25}}), Polygon(visible = true, origin = {-0, -10.704}, lineColor = {113, 113, 113}, fillColor = {255, 255, 255}, points = {{100, -89.296}, {50, -89.296}, {-50, -89.296}, {-100, -89.296}, {-100, -39.296}, {-100, 50.704}, {-100, 100.704}, {-50, 100.704}, {0, 100.704}, {20, 80.704}, {50, 80.704}, {100, 80.704}, {100, 30.704}, {100, -39.296}}, smooth = Smooth.Bezier)}));
end BusExample;