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