-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClosedLoop.adb
58 lines (45 loc) · 1.29 KB
/
ClosedLoop.adb
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
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with ImpulseGenerator;
with Measures;
with Heart;
with HRM;
with ICD;
Package body ClosedLoop is
procedure Init(cl : out ClosedLoopType) is
begin
--Initalise hrt, monitor, gen, icd
Heart.Init(cl.Hrt);
HRM.Init(cl.Monitor);
ICD.Init(cl.Icds);
ImpulseGenerator.Init(cl.Generator);
end Init;
procedure Off (cl : in out ClosedLoopType) is
begin
-- set all components to Off
ICD.Off(cl.Icds, cl.Monitor, cl.Generator);
Put_Line("Switched to Off mode");
end Off;
procedure On (cl : in out ClosedLoopType) is
begin
-- Set all components to On
ICD.On(cl.Icds, cl.Monitor, cl.Generator, cl.Hrt);
Put_Line("Switched to On mode");
end On;
procedure setTachycardiaBound (cl : out ClosedLoopType; ub : in Integer) is
begin
ICD.setTachycardiaBound(cl.Icds, ub);
end setTachycardiaBound;
procedure setFibrillationBound (cl : out ClosedLoopType; ub : in Integer) is
begin
ICD.setFibrillationBound(cl.Icds, ub);
end setFibrillationBound;
procedure tick (cl: in out ClosedLoopType) is
begin
-- tick all components
Heart.Tick(cl.Hrt);
HRM.Tick(cl.Monitor, cl.Hrt);
ICD.Tick(cl.Icds, cl.Monitor, cl.Generator);
ImpulseGenerator.Tick(cl.Generator, cl.Hrt);
end tick;
end ClosedLoop;