Ticket #5776: Package1.mo

File Package1.mo, 4.2 KB (added by ceraolo, 5 years ago)
Line 
1within ;
2package Package1
3  model Model1
4    SubModel1 subMod
5      annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
6    Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage annotation (
7        Placement(transformation(
8          extent={{10,-10},{-10,10}},
9          rotation=90,
10          origin={-40,-10})));
11    Modelica.Electrical.Analog.Basic.Resistor resistor annotation (Placement(
12          transformation(
13          extent={{-10,-10},{10,10}},
14          rotation=-90,
15          origin={40,-10})));
16  equation
17    connect(sineVoltage.p, subMod.pin_p)
18      annotation (Line(points={{-40,0},{-10,0}}, color={0,0,255}));
19    connect(resistor.p, subMod.pin_n)
20      annotation (Line(points={{40,0},{10,0}}, color={0,0,255}));
21    connect(sineVoltage.n, resistor.n) annotation (Line(points={{-40,-20},{-40,
22            -32},{40,-32},{40,-20}}, color={0,0,255}));
23    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
24          coordinateSystem(preserveAspectRatio=false)));
25  end Model1;
26
27  model SubModel1
28    Modelica.Electrical.Analog.Basic.Resistor resistor
29      annotation (Placement(transformation(extent={{26,-10},{46,10}})));
30    Modelica.Electrical.Analog.Basic.Resistor resistor1
31      annotation (Placement(transformation(extent={{-38,-10},{-18,10}})));
32    Modelica.Electrical.Analog.Interfaces.PositivePin pin_p
33      annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
34    Modelica.Electrical.Analog.Interfaces.NegativePin pin_n
35      annotation (Placement(transformation(extent={{90,-10},{110,10}})));
36  equation
37    connect(resistor1.n, resistor.p)
38      annotation (Line(points={{-18,0},{26,0}}, color={0,0,255}));
39    connect(resistor1.p, pin_p)
40      annotation (Line(points={{-38,0},{-100,0}}, color={0,0,255}));
41    connect(pin_n, resistor.n)
42      annotation (Line(points={{100,0},{46,0}}, color={0,0,255}));
43    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
44          coordinateSystem(preserveAspectRatio=false)));
45  end SubModel1;
46
47  package SubPackage1
48    model SubModel2
49      Modelica.Electrical.Analog.Basic.Resistor resistor
50        annotation (Placement(transformation(extent={{26,-10},{46,10}})));
51      Modelica.Electrical.Analog.Basic.Resistor resistor1
52        annotation (Placement(transformation(extent={{-38,-10},{-18,10}})));
53      Modelica.Electrical.Analog.Interfaces.PositivePin pin_p
54        annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
55      Modelica.Electrical.Analog.Interfaces.NegativePin pin_n
56        annotation (Placement(transformation(extent={{90,-10},{110,10}})));
57    equation
58      connect(resistor1.n, resistor.p)
59        annotation (Line(points={{-18,0},{26,0}}, color={0,0,255}));
60      connect(resistor1.p, pin_p)
61        annotation (Line(points={{-38,0},{-100,0}}, color={0,0,255}));
62      connect(pin_n, resistor.n)
63        annotation (Line(points={{100,0},{46,0}}, color={0,0,255}));
64      annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
65            coordinateSystem(preserveAspectRatio=false)));
66    end SubModel2;
67  end SubPackage1;
68
69  model Model2
70    Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage annotation (
71        Placement(transformation(
72          extent={{10,-10},{-10,10}},
73          rotation=90,
74          origin={-40,-10})));
75    Modelica.Electrical.Analog.Basic.Resistor resistor annotation (Placement(
76          transformation(
77          extent={{-10,-10},{10,10}},
78          rotation=-90,
79          origin={40,-10})));
80    SubPackage1.SubModel2 subMod
81      annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
82  equation
83    connect(sineVoltage.n, resistor.n) annotation (Line(points={{-40,-20},{-40,
84            -32},{40,-32},{40,-20}}, color={0,0,255}));
85    connect(sineVoltage.p, subMod.pin_p)
86      annotation (Line(points={{-40,0},{-10,0}}, color={0,0,255}));
87    connect(subMod.pin_n, resistor.p)
88      annotation (Line(points={{10,0},{40,0}}, color={0,0,255}));
89    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
90          coordinateSystem(preserveAspectRatio=false)));
91  end Model2;
92  annotation (uses(Modelica(version="3.2.3")));
93end Package1;