Skip to content

Commit 17dfe11

Browse files
feat: implement luminosity control agent
1 parent f1cab98 commit 17dfe11

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Diff for: src/agt/luminosityControl.asl

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
/*
10+
* This agent is responsible to monitor the luminosity inside the Operating Block and over the
11+
* surgical table in order to maintain it within the values of the user configuration.
12+
*/
13+
14+
!observeOperatingBlock.
15+
16+
+!observeOperatingBlock
17+
<- ?obtainObserver(OperatingBlockObserverId);
18+
focus(OperatingBlockObserverId).
19+
20+
// Operating Room
21+
+luminosity(RoomId, RoomType, Value)
22+
: optimalIlluminance(RoomType, OptimalAmbientLight, OptimalSurgicalLight) &
23+
Value \== OptimalAmbientLight
24+
<- .println(adjust_luminosity_operating_room);
25+
!setAmbientLight(RoomId, OptimalAmbientLight);
26+
!setSurgicalLight(RoomId, OptimalSurgicalLight).
27+
28+
// Pre/Post Operating Room
29+
+luminosity(RoomId, RoomType, Value)
30+
: optimalIlluminance(RoomType, OptimalAmbientLight) &
31+
Value \== OptimalAmbientLight
32+
<- .println(adjust_luminosity_pre_post_operating_room);
33+
!setAmbientLight(RoomId, OptimalAmbientLight).
34+
35+
// Ambient light set goal
36+
+!setAmbientLight(RoomId, Value)
37+
<- .concat(RoomId, "-ambientlight", ResultString);
38+
makeArtifact(ResultString, "artifact.environment.roomartifact.AmbientLight", [RoomId], AmbientLightId);
39+
setIntensity(Value) [aid(AmbientLightId)];
40+
disposeArtifact(AmbientLightId).
41+
42+
// Surgical light set goal
43+
+!setSurgicalLight(RoomId, Value)
44+
<- .concat(RoomId, "-surgicallight", ResultString);
45+
makeArtifact(ResultString, "artifact.environment.roomartifact.SurgicalLight", [RoomId], SurgicalLightId);
46+
setIntensity(Value) [aid(SurgicalLightId)];
47+
disposeArtifact(SurgicalLightId).
48+
49+
// Obtain the operating block observer
50+
+?obtainObserver(OperatingBlockObserverId)
51+
<- lookupArtifact("operating_block_observer", OperatingBlockObserverId).
52+
53+
-?obtainObserver(OperatingBlockObserverId)
54+
<- .wait(100);
55+
?obtainObserver(OperatingBlockObserverId).
56+
57+
{ include("$jacamoJar/templates/common-cartago.asl") }
58+
{ include("$jacamoJar/templates/common-moise.asl") }

0 commit comments

Comments
 (0)