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.himaude
193 lines (155 loc) · 5.3 KB
/
HVACSYS.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
*** #############################
*** A toy model HVAC system.
***
*** Author: Gary Read
***
*** Start: 01/03/2015
*** 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 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 .
eq heatingFlowRate = 10.0 .
eq coolingFlowRate = -5.0 .
eq offFlowRate = 0.0 .
eq lowTempVal = 50.0 .
eq highTempVal = 100.0 .
vars CONFIG REST : Configuration . *** Placeholders?
*** ###############################
*** 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 < PhysicalEntity .
*** Room dynamics
eq effortDyn(< ROOM : Room | >, SF)
= SF .
*** ###############################
*** 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) .
---( This is the same as above
--- eq timeCanAdvanceMult(
--- < HTR : Heater | entity : ROOM, state : heating, lowTemp : LT, highTemp : HT >
--- < ROOM : Room | effort : TEMP > REST )
--- =
--- (TEMP <= HT) and timeCanAdvanceMult(REST) .
--- eq timeCanAdvanceMult(
--- < HTR : Heater | entity : ROOM, state : cooling, lowTemp : LT, highTemp : HT >
--- < ROOM : Room | effort : TEMP > REST )
--- =
--- (TEMP >= LT) and timeCanAdvanceMult(REST) .
---)
endhom)
(homod SCENE is
inc HVACSYS .
op sm : -> Oid . *** System Manager required for HI-Maude
op cs1 : -> GlobalSystem . *** Case studie objects
op zzDataCol : -> Oid . *** Data collector
ops ROOM HTR : -> Oid .
*** Case study one: Room with Heater, maintaining temp of 50c <-> 100c
eq cs1 = {
< ROOM : Room | effort : 0.0,
effT : 0.0, effP : 0.0, edb : no >
< HTR : Heater | flow : 0.0,
entity : ROOM,
floT1 : 0.0, floT2 : 0.0, floT3 : 0.0,
edb : no, contDyn : component,
state : heating, heatFlowRate : 0.0,
lowTemp : lowTempVal, highTemp : highTempVal >
< zzDataCol : DataCollector | source : (ROOM), time : 0.0, result : "", dataShown : effort >
---< zzDataCol : DataCollector | source : (HTR), time : 0.0, result : "", dataShown : flow >
} .
endhom)
(homod ROOM-HEATER-MODEL-CHECKING is
inc TIMED-MODEL-CHECKER .
inc HVACSYS .
inc SCENE .
vars ROOM HTR : Oid .
var REST : Configuration .
var S : onOffStatusType .
vars TEMP LT HT : Float .
op temp-threshhold : -> Float .
eq temp-threshhold = 5.0 .
ops temp-ok temp-hot temp-cold : -> Prop [ctor] .
ops hvac-operating hvac-off : -> Prop [ctor] .
*** hvac-operating
ceq {REST < HTR : Heater | state : S >}
|=
hvac-operating = true if (S == heating) or (S == cooling) .
*** hvac-off
ceq {REST < HTR : Heater | state : S >}
|=
hvac-off = true if (S == off) .
*** temp-ok
ceq {REST < ROOM : Room | effort : TEMP >
< HTR : Heater | entity : ROOM, lowTemp : LT, highTemp : HT >}
|=
temp-ok = true if (abs(TEMP - HT) < temp-threshhold)
and
(abs(TEMP - LT) < temp-threshhold) .
*** temp-hot
ceq {REST < ROOM : Room | effort : TEMP >
< HTR : Heater | entity : ROOM, highTemp : HT >}
|=
temp-hot = true if (abs(TEMP - HT) < temp-threshhold) .
*** temp-cold
ceq {REST < ROOM : Room | effort : TEMP >
< HTR : Heater | entity : ROOM, lowTemp : LT >}
|=
temp-cold = true if (abs(TEMP - LT) < temp-threshhold) .
endhom)
eof .