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
/
HVACSYS_Coffee.himaude
307 lines (242 loc) · 9.26 KB
/
HVACSYS_Coffee.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
*** #############################
*** A toy model HVAC system. combined with coffee.himaude
***
*** Author: Gary Read
***
*** Start: 21/04/2015
*** Last Edit: 21/04/2015
***
*** Here we combine our discrete heater/cooler to the coffee.himaude module
*** that models the physical interactions between a cup of coffee in a closed
*** room. Together we can model the heating/cooling of a cup of coffee in an
*** air-conditioned or heated room
***
*** see page 22 from "..\Dissertation\Resources\techreport-casestudy.pdf"
*** #############################
(homod HVACSYS is
pr FLOAT .
inc HYBRID-LIB .
*** Heater states
sort onOffStatusType .
ops heating cooling off : -> onOffStatusType .
*** Constant variables
op heatingFlowRate : -> Float .
op coolingFlowRate : -> Float .
op offFlowRate : -> Float .
op lowTempVal : -> Float .
op highTempVal : -> Float .
op highTempValcs2 : -> Float .
eq heatingFlowRate = 10.0 .
eq coolingFlowRate = -5.0 .
eq offFlowRate = 0.0 .
eq lowTempVal = 70.0 .
eq highTempVal = 100.0 .
eq highTempValcs2 = 100.0 .
vars CONFIG REST : Configuration . *** Placeholders?
*** ###############################
*** ThermalEntity
*** ###############################
var TE : Oid .
vars SF, MASS, HC : Float . --- sum of heat flow, mass, heat cap
class ThermalEntity | heatCap : Float, mass : Float .
subclass ThermalEntity < PhysicalEntity .
eq effortDyn(< TE : ThermalEntity | heatCap : HC, mass : MASS >, SF)
= SF / (MASS * HC) .
*** ###############################
*** ThermalInteraction
*** ###############################
class ThermalInteraction | area : Float .
subclass ThermalInteraction < PhysicalInteraction .
*** ###############################
*** Room
*** ###############################
vars ROOM : Oid . *** HVAC and room object id's
vars TEMP EFF SF : Float . *** Effort, heat flow rate, sum of flows
class Room .
subclass Room < ThermalEntity .
*** ###############################
*** Coffee
*** ###############################
class Coffee .
subclass Coffee < ThermalEntity .
*** ###############################
*** Convection
*** ###############################
var CONV : Oid .
vars CC A T1 T2 : Float . --- Convection coef, area, temp of T1 and T2
class Convection | convCoef : Float .
subclass Convection < ThermalInteraction .
eq flowDyn(< CONV : Convection | area : A, convCoef : CC >, T1, T2)
= CC * A * (T1 - T2) .
*** ###############################
*** Conduction
*** ###############################
var COND : Oid .
vars K A L : Float .
class Conduction | thermalCond : Float, thickness : Float .
subclass Conduction < ThermalInteraction .
eq flowDyn(< COND : Conduction | area : A, thermalCond : K, thickness : L >, T1, T2)
= (K * A * (T1 - T2)) / L .
*** ###############################
*** Heater
*** ###############################
vars HTR : Oid .
var S : onOffStatusType .
vars HTRRT HTRSP HT LT : Float .
class Heater | state : onOffStatusType, heatFlowRate : Float, lowTemp : Float, highTemp : Float .
subclass Heater < FlowSource .
*** Heater dynamics
eq flowDyn(< HTR : Heater | state : heating, heatFlowRate : HTRRT, lowTemp : LT, highTemp : HT >, EFF) =
heatingFlowRate .
eq flowDyn(< HTR : Heater | state : cooling, heatFlowRate : HTRRT, lowTemp : LT, highTemp : HT >, EFF) =
coolingFlowRate .
eq flowDyn(< HTR : Heater | state : off, heatFlowRate : HTRRT, lowTemp : LT, highTemp : HT >, EFF) =
offFlowRate .
*** ###############################
*** Rewrite Rules
*** ###############################
crl[heater-cooling] :
< ROOM : Room | effort : TEMP >
< HTR : Heater | entity : ROOM, state : heating, highTemp : HT >
=>
< ROOM : Room | >
< HTR : Heater | state : cooling, heatFlowRate : -5.0 >
if TEMP >= HT .
crl[heater-on] :
< ROOM : Room | effort : TEMP >
< HTR : Heater | entity : ROOM, state : cooling, lowTemp : LT >
=>
< ROOM : Room | >
< HTR : Heater | state : heating, heatFlowRate : 1.0 >
if TEMP <= LT .
*** ###############################
*** Discrete Events
*** ###############################
eq timeCanAdvanceMult(
< HTR : Heater | entity : ROOM, state : S, lowTemp : LT, highTemp : HT >
< ROOM : Room | effort : TEMP > REST )
=
((S == heating and TEMP <= HT) or (S == cooling and TEMP >= LT)) and timeCanAdvanceMult(REST) .
endhom)
*** ########################################################
(homod SCENE is
inc HVACSYS .
op sm : -> Oid . *** System Manager required for HI-Maude
ops cs1 cs2 cs1-flow cs2-flow : -> GlobalSystem . *** Case studie objects
op zzDataCol : -> Oid . *** Data collector
*** Case study one: Room with Heater, maintaining temp of 50c <-> 100c
ops roomObj coffeeObj convObj condObj HTR : -> Oid .
eq cs1 = {
< HTR : Heater | flow : 0.0,
entity : roomObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
state : cooling,
heatFlowRate : 0.0,
lowTemp : lowTempVal,highTemp : highTempVal >
< roomObj : Room | effort : 20.0,
effT : 0.0,effP : 0.0,edb : no,
heatCap : 1.05,mass : 38.4 >
< coffeeObj : Coffee | effort : 95.0,
effT : 0.0, effP : 0.0,edb : no,
heatCap : 4.2,mass : 1.5 >
< convObj : Convection | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, convCoef : 0.02 >
< condObj : Conduction | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, thermalCond : 0.0015,
thickness : 0.005 >
< zzDataCol : DataCollector | source : (roomObj coffeeObj), time : 0.0, result : "", dataShown : effort >
---< zzDataCol : DataCollector | source : (convObj condObj HTR), time : 0.0, result : "", dataShown : flow >
} .
eq cs2 = {
< HTR : Heater | flow : 0.0,
entity : roomObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
state : heating,
heatFlowRate : 0.0,
lowTemp : lowTempVal,highTemp : highTempValcs2 >
< roomObj : Room | effort : 20.0,
effT : 0.0,effP : 0.0,edb : no,
heatCap : 1.05,mass : 38.4 >
< coffeeObj : Coffee | effort : 20.0,
effT : 0.0, effP : 0.0,edb : no,
heatCap : 4.2,mass : 5.0 >
< convObj : Convection | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, convCoef : 0.02 >
< condObj : Conduction | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, thermalCond : 0.0015,
thickness : 0.005 >
< zzDataCol : DataCollector | source : (roomObj coffeeObj), time : 0.0, result : "", dataShown : effort >
---< zzDataCol : DataCollector | source : (convObj condObj HTR), time : 0.0, result : "", dataShown : flow >
} .
eq cs1-flow = {
< HTR : Heater | flow : 0.0,
entity : roomObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
state : cooling,
heatFlowRate : 0.0,
lowTemp : lowTempVal,highTemp : highTempVal >
< roomObj : Room | effort : 20.0,
effT : 0.0,effP : 0.0,edb : no,
heatCap : 1.05,mass : 38.4 >
< coffeeObj : Coffee | effort : 95.0,
effT : 0.0, effP : 0.0,edb : no,
heatCap : 4.2,mass : 1.5 >
< convObj : Convection | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, convCoef : 0.02 >
< condObj : Conduction | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, thermalCond : 0.0015,
thickness : 0.005 >
---< zzDataCol : DataCollector | source : (roomObj coffeeObj), time : 0.0, result : "", dataShown : effort >
< zzDataCol : DataCollector | source : (convObj condObj HTR), time : 0.0, result : "", dataShown : flow >
} .
eq cs2-flow = {
< HTR : Heater | flow : 0.0,
entity : roomObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
state : heating,
heatFlowRate : 0.0,
lowTemp : lowTempVal,highTemp : highTempValcs2 >
< roomObj : Room | effort : 20.0,
effT : 0.0,effP : 0.0,edb : no,
heatCap : 1.05,mass : 38.4 >
< coffeeObj : Coffee | effort : 20.0,
effT : 0.0, effP : 0.0,edb : no,
heatCap : 4.2,mass : 5.0 >
< convObj : Convection | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, convCoef : 0.02 >
< condObj : Conduction | flow : 0.0,
entity1 : roomObj, entity2 : coffeeObj,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no,contDyn : component,
area : 0.5, thermalCond : 0.0015,
thickness : 0.005 >
---< zzDataCol : DataCollector | source : (roomObj coffeeObj), time : 0.0, result : "", dataShown : effort >
< zzDataCol : DataCollector | source : (convObj condObj HTR), time : 0.0, result : "", dataShown : flow >
} .
endhom)
eof .