18
18
start [aid(OperatingBlockObserverId)];
19
19
focus(OperatingBlockObserverId).
20
20
21
+ +temperature(RoomId, RoomType, Value)
22
+ : optimalTemperature(RoomType, OptimalValue) &
23
+ TollerancedOptimalValue = OptimalValue + 0 .5 &
24
+ Value > TollerancedOptimalValue
25
+ <- .println(cooling);
26
+ !turnOffHeating(RoomId);
27
+ !turnOnCooling(RoomId).
28
+
29
+ +temperature(RoomId, RoomType, Value)
30
+ : optimalTemperature(RoomType, OptimalValue) &
31
+ TollerancedOptimalValue = OptimalValue - 0 .5 &
32
+ Value < TollerancedOptimalValue
33
+ <- .println(heating);
34
+ !turnOffCooling(RoomId);
35
+ !turnOnHeating(RoomId).
36
+
37
+ +temperature(RoomId, RoomType, Value) : optimalTemperature(RoomType, OptimalValue) & Value == OptimalValue
38
+ <- .println(off);
39
+ !turnOffCooling(RoomId);
40
+ !turnOffHeating(RoomId).
41
+
42
+ // Cooling goal
43
+ +!turnOnCooling(RoomId) : not cooling(RoomId)
44
+ <- .concat(RoomId, "-cooler" , ResultString);
45
+ makeArtifact(ResultString, "artifact.environment.Cooler" , [RoomId], CoolerId);
46
+ turnOn [aid(CoolerId)];
47
+ +cooling(RoomId); // add mental note to not re-turn on
48
+ disposeArtifact(CoolerId).
49
+ -!turnOnCooling(RoomId)
50
+ <- true.
51
+
52
+ +!turnOffCooling(RoomId) : cooling(RoomId)
53
+ <- .concat(RoomId, "-cooler" , ResultString);
54
+ makeArtifact(ResultString, "artifact.environment.Cooler" , [RoomId], CoolerId);
55
+ turnOff [aid(CoolerId)];
56
+ -cooling(RoomId); // remove mental note to not re-turn off
57
+ disposeArtifact(CoolerId).
58
+ -!turnOffCooling(RoomId)
59
+ <- true.
60
+
61
+ // Heating goal
62
+ +!turnOnHeating(RoomId) : not heating(RoomId)
63
+ <- .concat(RoomId, "-heater" , ResultString);
64
+ makeArtifact(ResultString, "artifact.environment.Heater" , [RoomId], HeaterId);
65
+ turnOn [aid(HeaterId)];
66
+ +heating(RoomId); // add mental note to not re-turn on
67
+ disposeArtifact(HeaterId).
68
+ -!turnOnHeating(RoomId)
69
+ <- true.
70
+
71
+ +!turnOffHeating(RoomId) : heating(RoomId)
72
+ <- .concat(RoomId, "-heater" , ResultString);
73
+ makeArtifact(ResultString, "artifact.environment.Heater" , [RoomId], HeaterId);
74
+ turnOff [aid(HeaterId)];
75
+ -heating(RoomId); // remove mental note to not re-turn off
76
+ disposeArtifact(HeaterId).
77
+ -!turnOffHeating(RoomId)
78
+ <- true.
79
+
21
80
// Obtain the operating block observer
22
81
+?obtainObserver(OperatingBlockObserverId)
23
82
<- lookupArtifact("operating_block_observer" , OperatingBlockObserverId).
24
83
25
- // If the operating block observer artifact is not found in the workspace, then create it
26
84
-?obtainObserver(OperatingBlockObserverId)
27
- <- makeArtifact( "operating_block_observer" , "artifact.environment.OperatingBlockObserverArtifact" , [], OperatingBlockObserverId).
28
-
85
+ <- .wait(100);
86
+ ?obtainObserver(OperatingBlockObserverId).
29
87
30
88
{ include("$jacamoJar/templates/common-cartago.asl" ) }
31
89
{ include("$jacamoJar/templates/common-moise.asl" ) }
0 commit comments