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
/
coffee.himaude
210 lines (165 loc) · 6.4 KB
/
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
*** #############################
*** Closed thermal system model, cups of coffee in a room.
***
*** Author: Gary Read
***
*** Start: 20/01/2015
*** Last Edit: 20/04/2015
***
*** Using the features of HI-Maude to describe the flow of effort
*** between different physical thermal objects, in thus case room
*** and cups of coffee. We also try out some object oriented behviour
*** that HI-Maude has.
***
*** #############################
(homod THERMO-SYSTEM is
inc HYBRID-LIB . --- provides effortDyn etc.
class ThermalEntity | heatCap : Float, mass : Float .
subclass ThermalEntity < PhysicalEntity .
class Room .
subclass Room < ThermalEntity .
class Coffee .
subclass Coffee < ThermalEntity .
class ThermalInteraction | area : Float .
subclass ThermalInteraction < PhysicalInteraction .
class Convection | convCoef : Float .
class Conduction | thermalCond : Float, thickness : Float .
subclass Convection Conduction < ThermalInteraction .
var TE : Oid .
vars SF, MASS, HC : Float . --- sum of heat flow, mass, heat cap
var CONV : Oid .
vars CC A T1 T2 : Float . --- Convection coef, area, temp of T1 and T2
var COND : Oid .
vars K A L : Float .
eq effortDyn(< TE : ThermalEntity | heatCap : HC, mass : MASS >, SF)
= SF / (MASS * HC) .
eq flowDyn(< CONV : Convection | area : A, convCoef : CC >, T1, T2)
= CC * A * (T1 - T2) .
eq flowDyn(< COND : Conduction | area : A, thermalCond : K, thickness : L >, T1, T2)
= (K * A * (T1 - T2)) / L .
endhom)
(homod SCENE is
pr FLOAT .
inc THERMO-SYSTEM .
ops cs1 cs2 cs3 cs4 : -> GlobalSystem .
op zzDataCol : -> Oid .
ops roomObj coffeeObj coffeeMug convObj condObj heaterObj : -> Oid .
op sm : -> Oid . --- System Manager required for HI-Maude
--- Multiple coffee objects
eq cs4 = {
< 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 : 0.45 >
< coffeeMug : Coffee | effort : 0.0,
effT : 0.0, effP : 0.0, edb : no,
heatCap : 4.2, mass : 0.2 >
< 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 >
< convObj : Convection | flow : 0.0,
entity1 : roomObj, entity2 : coffeeMug,
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 : coffeeMug,
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 : (coffeeObj coffeeMug roomObj), time : 0.0, result : "", dataShown : effort >
< zzDataCol : DataCollector | source : (convObj condObj convObj condObj), time : 0.0, result : "", dataShown : flow >
} .
--- Single coffee object
eq cs1 = {
< 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 : 0.45 >
< 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), time : 0.0, result : "", dataShown : flow >
} .
--- Single small coffee cup
eq cs2 = {
< 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 : 0.45 >
< 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.2, thermalCond : 0.0015,
thickness : 0.003 >
---< zzDataCol : DataCollector | source : (roomObj coffeeObj), time : 0.0, result : "", dataShown : effort >
< zzDataCol : DataCollector | source : (convObj condObj), time : 0.0, result : "", dataShown : flow >
} .
--- Single large coffee cup
eq cs3 = {
< 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 : 0.45 >
< 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 : 1.2, thermalCond : 0.0015,
thickness : 0.01 >
---< zzDataCol : DataCollector | source : (roomObj coffeeObj), time : 0.0, result : "", dataShown : effort >
< zzDataCol : DataCollector | source : (convObj condObj), time : 0.0, result : "", dataShown : flow >
} .
endhom)
**************************
*** Model checking ***
**************************
(homod MODEL-CHECKING is
inc SCENE .
inc TIMED-MODEL-CHECKER .
var REST : Configuration .
var E : Oid .
var T : Float .
ops temp-ok : -> Prop [ctor] .
ceq {REST < E : Coffee | effort : T >}
|=
temp-ok = true if T >= 65.0 and T <= 95.0 .
endhom)
eof .