This repository has been archived by the owner on Mar 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fluidsystem-discrete.himaude
162 lines (131 loc) · 4.7 KB
/
fluidsystem-discrete.himaude
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
*** #############################
*** A toy model gravitational fluid flow system.
***
*** Author: Gary Read
***
*** Last Edit: 03/04/2015
***
*** Here I am modeling a heating and cooling system with a room.
*** The aim is to gain experience with the HI-Maude tool and
*** specifically with discrete events and timeCanAdvance function.
***
*** see page 22 from "..\Dissertation\Resources\techreport-casestudy.pdf"
*** #############################
(homod TEST is
pr FLOAT .
inc HYBRID-LIB . --- provides effortDyn etc.
inc PS-BASIC-CLASSES . --- provides flowDyn etc.
*** Vessel filled status
sort FilledStatusType .
ops filled empty : -> FilledStatusType .
*** ###############################
*** Vessels
*** ###############################
class FluidEntity | area : Float, height : Float, status : FilledStatusType .
subclass FluidEntity < PhysicalEntity .
var HTANK FTANK : Oid . --- Header/Footer tank objects
vars SF, A, H : Float . --- sum of fluid flow, mass, heat cap
eq effortDyn(< HTANK : FluidEntity | area : A, height : H, status : filled >, SF)
= SF .
eq effortDyn(< HTANK : FluidEntity | area : A, height : H, status : empty >, SF)
= 0.0 .
*** ###############################
*** Gravitation flow
*** ###############################
class GravitationalPipeFlow | orificeArea : Float, dischargeCoef : Float, headerTankArea : Float, gravAcc : Float .
subclass GravitationalPipeFlow < PhysicalInteraction .
var GRAVFLOW : Oid . --- Grav pipe flow
vars HTAREA GA OA DCOEF V1 V2 : Float . --- header tank area, grav acc, orificeArea, dischargeCoef, volume of E1 and E2
ceq flowDyn(< GRAVFLOW : GravitationalPipeFlow | headerTankArea : HTAREA, gravAcc : GA, orificeArea : OA, dischargeCoef : DCOEF >, V1, V2)
= DCOEF * OA * sqrt(2.0 * GA * (V1 / HTAREA))
if V1 >= 0 .
*** ###############################
*** Rewrite Rules
*** ###############################
crl[empty] :
< HTANK : FluidEntity | effort : V1, status : filled >
< GRAVFLOW : GravitationalPipeFlow | entity1 : HTANK, flow : SF >
=>
< HTANK : FluidEntity | status : empty >
< GRAVFLOW : GravitationalPipeFlow | flow : 0.0 >
if V1 <= 0.0 .
*** ###############################
*** Discrete Events
*** ###############################
eq timeCanAdvanceMult(
< HTANK : FluidEntity | effort : V1 >
< GRAVFLOW : GravitationalPipeFlow | entity1 : HTANK >
=
(V1 >= 0.0) and timeCanAdvanceMult(REST) .
endhom)
(homod SCENE is
pr FLOAT .
inc TEST .
ops cs1 cs2 : -> GlobalSystem .
op zzDataCol : -> Oid .
ops headerTank footerTank gravFlow : -> Oid .
op sm : -> Oid .
ops HTAREA HTHEIGHT FTAREA FTHEIGHT GA OAREA DCOEF : -> Float .
eq HTAREA = 2.0 * 2.0 .
eq HTHEIGHT = 1000.0 .
eq FTAREA = 0.5 * 0.5 .
eq FTHEIGHT = 0.0 .
eq GA = 9.81 .
eq OAREA = 0.157 .
eq DCOEF = 0.71 .
eq cs1 = {
< headerTank : FluidEntity |effort : 500000.0,
effT : 0.0,
effP : 0.0,
edb : no,
area : HTAREA,
height : HTHEIGHT,
effort : HTAREA * HTHEIGHT >
< footerTank : FluidEntity |effort : 0.0,
effT : 0.0,
effP : 0.0,
edb : no,
area : FTAREA,
height : FTHEIGHT >
< gravFlow : GravitationalPipeFlow | flow : 0.0,
entity1 : headerTank,
entity2 : footerTank,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,
contDyn : component,
headerTankArea : HTAREA,
gravAcc : GA,
orificeArea : OAREA,
dischargeCoef : DCOEF >
< zzDataCol : DataCollector | source : (headerTank footerTank), time : 0.0, result : "",dataShown : effort >
---< zzDataCol : DataCollector | source : (gravFlow), time : 0.0, result : "",dataShown : flow >
} .
eq cs2 = {
< headerTank : FluidEntity | effort : 500000.0,
effT : 0.0,
effP : 0.0,
edb : no,
area : HTAREA,
height : HTHEIGHT,
effort : HTAREA * HTHEIGHT >
< footerTank : FluidEntity | effort : 0.0,
effT : 0.0,
effP : 0.0,
edb : no,
area : FTAREA,
height : FTHEIGHT >
< gravFlow : GravitationalPipeFlow | flow : 0.0,
entity1 : headerTank,
entity2 : footerTank,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,
contDyn : component,
headerTankArea : HTAREA,
gravAcc : GA,
orificeArea : OAREA,
dischargeCoef : DCOEF >
---< zzDataCol : DataCollector | source : (headerTank footerTank), time : 0.0, result : "",dataShown : effort >
< zzDataCol : DataCollector | source : (gravFlow), time : 0.0, result : "",dataShown : flow >
} .
endhom)
eof .