Skip to content

Commit

Permalink
#27, #32 - Produce a sliding average for the current heart rate of the
Browse files Browse the repository at this point in the history
workout session.
  • Loading branch information
John Wolfe committed Jun 13, 2014
1 parent 459bafc commit 5f54d8b
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 67 deletions.
50 changes: 37 additions & 13 deletions applications/gps/GPS Watch/models/GPS Watch/GPS Watch.xtuml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- BP 7.1 content: SystemModel syschar: 3 persistence-version: 7.1.6
-- BP 7.1.6 content: SystemModel syschar: 3 persistence-version: 7.1.6

INSERT INTO S_SYS
VALUES ("36a41cf7-d411-488d-99fc-74866d4fea39",
Expand Down Expand Up @@ -29,7 +29,7 @@ INSERT INTO GD_GE
"1ddecfd8-6290-41c5-93e6-0da10a8fa5b1",
108,
0,
'');
'GPS Watch::Analysis');
INSERT INTO GD_SHP
VALUES ("f0433287-013c-4f23-8dbb-0d2546c8c5af");
INSERT INTO GD_NCS
Expand All @@ -53,7 +53,7 @@ INSERT INTO GD_GE
"790e7d2c-489e-4954-ae54-14cc9921c27c",
108,
0,
'');
'GPS Watch::HeartRateMonitorInterfaces');
INSERT INTO GD_SHP
VALUES ("b899ff75-deb3-446e-8eea-d7a89826605f");
INSERT INTO GD_NCS
Expand All @@ -77,7 +77,7 @@ INSERT INTO GD_GE
"7f2c44cf-cf23-4bf3-afa0-bf960f82e08e",
108,
0,
'');
'GPS Watch::LocationInterfaces');
INSERT INTO GD_SHP
VALUES ("82cd8a06-b3ea-4d6e-a6d5-4bddfcbaebc1");
INSERT INTO GD_NCS
Expand All @@ -101,7 +101,7 @@ INSERT INTO GD_GE
"9b961245-c46b-4875-ad99-15876a73b681",
108,
0,
'');
'GPS Watch::UIInterfaces');
INSERT INTO GD_SHP
VALUES ("96b7bff5-c413-4d34-beeb-27bbfd181403");
INSERT INTO GD_NCS
Expand All @@ -125,7 +125,7 @@ INSERT INTO GD_GE
"2b0c8fd6-d69a-4306-9ef2-2fa3c850b738",
108,
0,
'');
'GPS Watch::Library');
INSERT INTO GD_SHP
VALUES ("409c66b2-f6a8-4635-ab6d-609f6055c2f6");
INSERT INTO GD_NCS
Expand All @@ -149,7 +149,7 @@ INSERT INTO GD_GE
"f8a6a6be-a419-4e76-b3ae-f4d8862c10bf",
108,
0,
'');
'GPS Watch::LocationDataTypes');
INSERT INTO GD_SHP
VALUES ("1c4ac19d-78b9-4f51-85c0-2c49a1db8cf4");
INSERT INTO GD_NCS
Expand All @@ -173,7 +173,7 @@ INSERT INTO GD_GE
"7e10fb9d-9dc9-4b77-b365-4e2a652c45da",
108,
0,
'');
'GPS Watch::UIDataTypes');
INSERT INTO GD_SHP
VALUES ("05fc6401-ea6e-41da-ac10-85c69fa4dd0b");
INSERT INTO GD_NCS
Expand All @@ -197,7 +197,7 @@ INSERT INTO GD_GE
"4971b185-e248-48bc-9109-70a9a5229274",
108,
0,
'');
'GPS Watch::System');
INSERT INTO GD_SHP
VALUES ("3850dd5d-de4c-4109-a212-68be025b6ccf");
INSERT INTO GD_NCS
Expand All @@ -221,7 +221,7 @@ INSERT INTO GD_GE
"94635a7b-738e-43f0-ad8f-ef6a5d7c5a1a",
108,
0,
'');
'GPS Watch::Use Cases');
INSERT INTO GD_SHP
VALUES ("9c822e94-bd6b-45dc-b77c-bcc695fed855");
INSERT INTO GD_NCS
Expand All @@ -245,7 +245,7 @@ INSERT INTO GD_GE
"64addca0-c13d-47de-9282-9476b0cb4317",
108,
0,
'');
'GPS Watch::Sequences');
INSERT INTO GD_SHP
VALUES ("4bbf27e4-016b-4951-9d02-afd6d954a734");
INSERT INTO GD_NCS
Expand All @@ -269,7 +269,7 @@ INSERT INTO GD_GE
"c4db7d83-7a88-46de-81dd-7d9c8a3c56fa",
108,
0,
'');
'GPS Watch::Activities');
INSERT INTO GD_SHP
VALUES ("7faeb67d-c376-47f8-b56a-a5481632d6b8");
INSERT INTO GD_NCS
Expand All @@ -293,7 +293,7 @@ INSERT INTO GD_GE
"17c3020a-fcc0-4d49-8947-26d397cdf2f0",
108,
0,
'');
'GPS Watch::Shared EEs');
INSERT INTO GD_SHP
VALUES ("13ebdc0b-8f38-4982-82cc-89528e3d706b");
INSERT INTO GD_NCS
Expand All @@ -311,6 +311,30 @@ INSERT INTO DIM_ELE
VALUES ("13ebdc0b-8f38-4982-82cc-89528e3d706b",
0,
"00000000-0000-0000-0000-000000000000");
INSERT INTO GD_GE
VALUES ("6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2",
"98dae3be-847f-424f-816d-5e5e54bb02a3",
"01415eff-e2d2-4a16-af80-2900a97e7fdd",
108,
0,
'GPS Watch::HeartRateTypes');
INSERT INTO GD_SHP
VALUES ("6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2");
INSERT INTO GD_NCS
VALUES ("6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2");
INSERT INTO DIM_ND
VALUES (200.000000,
150.000000,
"6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2");
INSERT INTO DIM_GE
VALUES (5416.000000,
3216.000000,
"6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
VALUES ("6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2",
0,
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_DIA
VALUES ("98dae3be-847f-424f-816d-5e5e54bb02a3",
'',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
-- BP 7.1.6 content: Package syschar: 3 persistence-version: 7.1.6

INSERT INTO EP_PKG
VALUES ("01415eff-e2d2-4a16-af80-2900a97e7fdd",
"36a41cf7-d411-488d-99fc-74866d4fea39",
"36a41cf7-d411-488d-99fc-74866d4fea39",
'HeartRateTypes',
'',
0);
INSERT INTO GD_MD
VALUES ("df50210b-98f5-4d35-a865-db8ebbcdcadf",
112,
"01415eff-e2d2-4a16-af80-2900a97e7fdd",
108,
0,
0,
1,
1,
1,
12,
1,
0,
0,
200,
150,
0,
'4.1.10',
'GPS Watch::HeartRateTypes');
INSERT INTO GD_GE
VALUES ("72075ecb-96b8-4a6f-8f3e-e295fcab7056",
"df50210b-98f5-4d35-a865-db8ebbcdcadf",
"3c57dcb2-f11d-4cf3-b24e-e04eaaff0894",
109,
0,
'GPS Watch::HeartRateTypes::HeartRateConstants');
INSERT INTO GD_SHP
VALUES ("72075ecb-96b8-4a6f-8f3e-e295fcab7056");
INSERT INTO GD_NCS
VALUES ("72075ecb-96b8-4a6f-8f3e-e295fcab7056");
INSERT INTO DIM_ND
VALUES (253.000000,
156.000000,
"72075ecb-96b8-4a6f-8f3e-e295fcab7056");
INSERT INTO DIM_GE
VALUES (4116.000000,
3060.000000,
"72075ecb-96b8-4a6f-8f3e-e295fcab7056",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
VALUES ("72075ecb-96b8-4a6f-8f3e-e295fcab7056",
0,
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_DIA
VALUES ("df50210b-98f5-4d35-a865-db8ebbcdcadf",
'',
1.000000,
4000.000000,
3000.000000,
"00000000-0000-0000-0000-000000000000");
INSERT INTO CNST_CSP
VALUES ("3c57dcb2-f11d-4cf3-b24e-e04eaaff0894",
'HeartRateConstants',
'SamplingPeriod is expressed in seconds and represents the period at which heart-rate samples are recorded.
AveragingWindow is expressed in samples and represents the number of samples used when calculating the current average.');
INSERT INTO CNST_SYC
VALUES ("0ee953d6-082a-4cae-ab05-d31f24dc217d",
'HeartRateSamplingPeriod',
'',
"ba5eda7a-def5-0000-0000-000000000002",
"3c57dcb2-f11d-4cf3-b24e-e04eaaff0894",
"00000000-0000-0000-0000-000000000000",
"00000000-0000-0000-0000-000000000000");
INSERT INTO CNST_LFSC
VALUES ("0ee953d6-082a-4cae-ab05-d31f24dc217d",
"ba5eda7a-def5-0000-0000-000000000002");
INSERT INTO CNST_LSC
VALUES ("0ee953d6-082a-4cae-ab05-d31f24dc217d",
"ba5eda7a-def5-0000-0000-000000000002",
'3');
INSERT INTO CNST_SYC
VALUES ("a72eef67-452b-4cab-9c0b-185cf56a8470",
'HeartRateAveragingWindow',
'',
"ba5eda7a-def5-0000-0000-000000000002",
"3c57dcb2-f11d-4cf3-b24e-e04eaaff0894",
"0ee953d6-082a-4cae-ab05-d31f24dc217d",
"ba5eda7a-def5-0000-0000-000000000002");
INSERT INTO CNST_LFSC
VALUES ("a72eef67-452b-4cab-9c0b-185cf56a8470",
"ba5eda7a-def5-0000-0000-000000000002");
INSERT INTO CNST_LSC
VALUES ("a72eef67-452b-4cab-9c0b-185cf56a8470",
"ba5eda7a-def5-0000-0000-000000000002",
'5');
INSERT INTO PE_PE
VALUES ("3c57dcb2-f11d-4cf3-b24e-e04eaaff0894",
1,
"01415eff-e2d2-4a16-af80-2900a97e7fdd",
"00000000-0000-0000-0000-000000000000",
10);
INSERT INTO PE_PE
VALUES ("01415eff-e2d2-4a16-af80-2900a97e7fdd",
1,
"00000000-0000-0000-0000-000000000000",
"00000000-0000-0000-0000-000000000000",
7);
INSERT INTO S_SYS_PROXY
VALUES ("36a41cf7-d411-488d-99fc-74866d4fea39",
'GPS Watch',
1,
'../GPS Watch.xtuml');
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ if (empty monitor)
end if;
monitor.recentHeartRate = 50;

LOG::LogInfo(message: "listener registered with interval: 3 sec");
LOG::LogInfo(message: "listener registered");

// start timer
create event instance timeout of HeartRateMonitor_A3:timeout() to HeartRateMonitor class;
monitor.timer = TIM::timer_start_recurring(event_inst: timeout, microseconds: 3000000); ',
monitor.timer = TIM::timer_start_recurring( event_inst: timeout, microseconds: (HeartRateSamplingPeriod * 1000000) ); ',
'');
INSERT INTO SM_TAH
VALUES ("d010be6b-0e95-4a7f-b75c-7c90f5b75a13",
Expand Down Expand Up @@ -274,7 +274,7 @@ INSERT INTO GD_MD
0,
0,
0,
'',
'4.1.10',
'GPS Watch::Library::HeartRateMonitor::HeartRateMonitor::HeartRateMonitor::Class State Machine');
INSERT INTO GD_GE
VALUES ("35daa71c-83e4-4e99-b3b9-389db6452069",
Expand Down
Loading

0 comments on commit 5f54d8b

Please sign in to comment.