1 | within ;
|
---|
2 | package RedeclarationComponents
|
---|
3 | extends Modelica.Icons.Package;
|
---|
4 |
|
---|
5 | partial model PartialExample
|
---|
6 | extends Modelica.Icons.Example;
|
---|
7 |
|
---|
8 | replaceable Components.BaseComponentA componentA annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
|
---|
9 | replaceable Components.BaseComponentB componentB annotation (Placement(transformation(extent={{20,-10},{40,10}})));
|
---|
10 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)));
|
---|
11 | end PartialExample;
|
---|
12 |
|
---|
13 | model ExampleAB
|
---|
14 | extends PartialExample(
|
---|
15 | redeclare RedeclarationComponents.Components.ComponentA componentA,
|
---|
16 | redeclare RedeclarationComponents.Components.ComponentB componentB);
|
---|
17 | Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T=293.15) annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
|
---|
18 | Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow(Q_flow=1) annotation (Placement(transformation(extent={{80,-10},{60,10}})));
|
---|
19 | equation
|
---|
20 | connect(fixedTemperature.port, componentA.port_a) annotation (Line(points={{-60,0},{-50,0},{-40,0}}, color={191,0,0}));
|
---|
21 | connect(componentA.port_b, componentB.port_a) annotation (Line(points={{-20,0},{20,0},{20,0}}, color={191,0,0}));
|
---|
22 | connect(componentB.port_b, fixedHeatFlow.port) annotation (Line(points={{40,0},{46,0},{60,0}}, color={191,0,0}));
|
---|
23 | end ExampleAB;
|
---|
24 |
|
---|
25 | package Components
|
---|
26 | extends Modelica.Icons.Package;
|
---|
27 | model BaseComponentA
|
---|
28 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
|
---|
29 | annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={Rectangle(
|
---|
30 | extent={{-100,100},{100,-100}},
|
---|
31 | lineColor={28,108,200},
|
---|
32 | fillColor={255,255,255},
|
---|
33 | fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio=false)));
|
---|
34 | end BaseComponentA;
|
---|
35 |
|
---|
36 | model BaseComponentB
|
---|
37 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b annotation (Placement(transformation(extent={{90,-10},{110,10}})));
|
---|
38 | annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={Rectangle(
|
---|
39 | extent={{-100,100},{100,-100}},
|
---|
40 | lineColor={28,108,200},
|
---|
41 | fillColor={255,255,255},
|
---|
42 | fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio=false)));
|
---|
43 | end BaseComponentB;
|
---|
44 |
|
---|
45 | model ComponentA
|
---|
46 | extends BaseComponentA;
|
---|
47 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b annotation (Placement(transformation(extent={{90,-10},{110,10}})));
|
---|
48 | equation
|
---|
49 | connect(port_a, port_b) annotation (Line(points={{-100,0},{100,0},{100,0}}, color={191,0,0}));
|
---|
50 | annotation (Icon(graphics={Text(
|
---|
51 | extent={{-40,-40},{40,42}},
|
---|
52 | lineColor={28,108,200},
|
---|
53 | textString="A")}));
|
---|
54 | end ComponentA;
|
---|
55 |
|
---|
56 | model ComponentB
|
---|
57 | extends BaseComponentB;
|
---|
58 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
|
---|
59 | equation
|
---|
60 | connect(port_a, port_b) annotation (Line(points={{-100,0},{100,0},{100,0}}, color={191,0,0}));
|
---|
61 | annotation (Icon(graphics={Text(
|
---|
62 | extent={{-40,-40},{40,42}},
|
---|
63 | lineColor={28,108,200},
|
---|
64 | textString="B")}));
|
---|
65 | end ComponentB;
|
---|
66 | end Components;
|
---|
67 | annotation (uses(Modelica(version="3.2.2")));
|
---|
68 | end RedeclarationComponents;
|
---|