Ticket #1805: Test.mo

File Test.mo, 1.3 KB (added by anonymous, 12 years ago)
Line 
1partial package MyPartialMedium
2 replaceable partial function MyFunction
3 output Modelica.SIunits.SpecificHeatCapacityAtConstantPressure CP "Cp";
4 end MyFunction;
5end MyPartialMedium;
6
7
8package MyMedium1
9 extends MyPartialMedium;
10 redeclare function extends MyFunction
11 algorithm
12 CP:=1;
13 end MyFunction;
14end MyMedium1;
15
16package MyMedium2
17 extends MyPartialMedium;
18 redeclare function extends MyFunction
19 algorithm
20 CP:=2;
21 end MyFunction;
22end MyMedium2;
23
24model MyComponent
25 replaceable package componentMedium = MyMedium1 constrainedby MyPartialMedium;
26 Real result;
27equation
28 result = componentMedium.MyFunction();
29end MyComponent;
30
31model MyModel1
32 replaceable package model1Medium = MyMedium1 constrainedby MyPartialMedium;
33 MyComponent comp(redeclare package componentMedium = model1Medium);
34 Real result;
35equation
36 result = comp.result;
37end MyModel1;
38
39model MyModel2
40 replaceable package model2Medium = MyMedium2 constrainedby MyPartialMedium;
41 MyComponent comp(redeclare package componentMedium = model2Medium);
42 Real result;
43equation
44 result = comp.result;
45end MyModel2;
46
47model MyModel3
48 MyModel1 model1(redeclare package model1Medium = MyMedium2);
49 Real result;
50equation
51 result = model1.result;
52end MyModel3;
53
54
55