| 8 | |
| 9 | {{{ |
| 10 | package Testlib |
| 11 | model World |
| 12 | replaceable package Fluid = Testlib.Fluids.BaseFluid constrainedby |
| 13 | Testlib.Fluids.partialFluidPackage; |
| 14 | //extends Fluid.FluidParameters; |
| 15 | // function to calculate Rho |
| 16 | function calcRho = Fluid.calcRho; |
| 17 | annotation (defaultComponentName="fluidWorld2", |
| 18 | defaultComponentPrefixes="inner", |
| 19 | missingInnerMesage = "You will need a World componend within the model!",Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( |
| 20 | coordinateSystem(preserveAspectRatio=false))); |
| 21 | end World; |
| 22 | package Fluids |
| 23 | partial package partialFluidPackage |
| 24 | end partialFluidPackage; |
| 25 | package BaseFluid |
| 26 | extends Testlib.Fluids.partialFluidPackage; |
| 27 | record FluidParameters |
| 28 | parameter Real a = 3; |
| 29 | end FluidParameters; |
| 30 | function calcRho |
| 31 | output Real rho; |
| 32 | algorithm |
| 33 | rho :=5; |
| 34 | end calcRho; |
| 35 | end BaseFluid; |
| 36 | package Fluid1 |
| 37 | extends Testlib.Fluids.partialFluidPackage; |
| 38 | record FluidParameters |
| 39 | parameter Real b = 33; |
| 40 | end FluidParameters; |
| 41 | function calcRho |
| 42 | output Real rho; |
| 43 | algorithm |
| 44 | rho := 8; |
| 45 | end calcRho; |
| 46 | end Fluid1; |
| 47 | end Fluids; |
| 48 | model Component |
| 49 | outer Testlib.World fluidWorld2; |
| 50 | Real p; |
| 51 | Real rho; |
| 52 | equation |
| 53 | p = time; |
| 54 | rho = fluidWorld2.calcRho(); |
| 55 | end Component; |
| 56 | model test |
| 57 | inner World fluidWorld2(redeclare package Fluid = Fluids.Fluid1); |
| 58 | Component component; |
| 59 | end test; |
| 60 | end Testlib; |
| 61 | |
| 62 | }}} |
| 63 | |