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