Skip to content

Commit

Permalink
#27 - Added support for creating goal specifications to the UI interface
Browse files Browse the repository at this point in the history
definition and one function for creating a set of goal specs.  Also
added reset support for goals.  Tested with Verifier and basic goal
capaiblities appear to work fine.  A few things to consider include:
1. Goal min/max/disposition/indicator is weird for pace because a lower
number means a faster (higher) speed.  Need to decide whether to change
the way this works.
2. Add a behavioral model of the user with some functions that allow his
speed and heart rate to be manipulated.
3. Convert Display from class-based state model to instance-based
singleton state model, eliminating assignment of interface signals to
transitions, replacing them with port OAL that generates the appropriate
event.
  • Loading branch information
John Wolfe committed Jul 11, 2014
1 parent aa57013 commit 6de35ab
Show file tree
Hide file tree
Showing 12 changed files with 658 additions and 398 deletions.
26 changes: 25 additions & 1 deletion applications/gps/GPS Watch/models/GPS Watch/GPS Watch.xtuml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ INSERT INTO GD_MD
200,
150,
0,
'3.5.3',
'4.1.12',
'GPS Watch');
INSERT INTO GD_GE
VALUES ("f0433287-013c-4f23-8dbb-0d2546c8c5af",
Expand Down Expand Up @@ -335,6 +335,30 @@ INSERT INTO DIM_ELE
VALUES ("6fa55b34-e1a3-4a80-b4d5-f15a5b5761b2",
0,
"00000000-0000-0000-0000-000000000000");
INSERT INTO GD_GE
VALUES ("b636444d-1843-4cea-a3dc-a4fdc6b81598",
"98dae3be-847f-424f-816d-5e5e54bb02a3",
"ddb10b91-57d4-4aea-a66c-6c3ea043ba5b",
108,
0,
'GPS Watch::TrackingDataTypes');
INSERT INTO GD_SHP
VALUES ("b636444d-1843-4cea-a3dc-a4fdc6b81598");
INSERT INTO GD_NCS
VALUES ("b636444d-1843-4cea-a3dc-a4fdc6b81598");
INSERT INTO DIM_ND
VALUES (200.000000,
150.000000,
"b636444d-1843-4cea-a3dc-a4fdc6b81598");
INSERT INTO DIM_GE
VALUES (4536.000000,
3420.000000,
"b636444d-1843-4cea-a3dc-a4fdc6b81598",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
VALUES ("b636444d-1843-4cea-a3dc-a4fdc6b81598",
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
Expand Up @@ -29,7 +29,7 @@ INSERT INTO GD_MD
200,
150,
0,
'',
'4.1.12',
'GPS Watch::Library::Tracking');
INSERT INTO GD_GE
VALUES ("1f51b134-2b1d-4529-91cb-a5458f99aff4",
Expand Down Expand Up @@ -115,8 +115,8 @@ INSERT INTO DIM_ND
0.000000,
"63530199-470d-4f74-8e27-c7f04690b20a");
INSERT INTO DIM_GE
VALUES (0.000000,
0.000000,
VALUES (1958.000000,
1532.000000,
"63530199-470d-4f74-8e27-c7f04690b20a",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -215,8 +215,8 @@ INSERT INTO DIM_ND
0.000000,
"92b33c3f-7397-435a-b45f-e4cb8a8742ea");
INSERT INTO DIM_GE
VALUES (0.000000,
0.000000,
VALUES (2694.000000,
1292.000000,
"92b33c3f-7397-435a-b45f-e4cb8a8742ea",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -315,8 +315,8 @@ INSERT INTO DIM_ND
0.000000,
"ea53cfaa-ac3b-4e9a-ac9d-45add2663332");
INSERT INTO DIM_GE
VALUES (0.000000,
0.000000,
VALUES (3209.000000,
1530.000000,
"ea53cfaa-ac3b-4e9a-ac9d-45add2663332",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -415,8 +415,8 @@ INSERT INTO DIM_ND
0.000000,
"bc9c5a1a-638e-4581-94bb-5e96323ab875");
INSERT INTO DIM_GE
VALUES (0.000000,
0.000000,
VALUES (1971.000000,
1574.000000,
"bc9c5a1a-638e-4581-94bb-5e96323ab875",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -499,30 +499,6 @@ INSERT INTO DIM_ELE
VALUES ("d8677561-de3d-426c-bcce-92e25ff4e087",
0,
"1f51b134-2b1d-4529-91cb-a5458f99aff4");
INSERT INTO GD_GE
VALUES ("f9c3ec82-219d-4f4c-86e6-14892d5f2124",
"af703f34-a5d6-467e-ad32-c2fc2af9ed45",
"37e62abd-d1c2-4241-a4cb-9aa88fabd6e8",
108,
0,
'GPS Watch::Library::Tracking::TrackingDataTypes');
INSERT INTO GD_SHP
VALUES ("f9c3ec82-219d-4f4c-86e6-14892d5f2124");
INSERT INTO GD_NCS
VALUES ("f9c3ec82-219d-4f4c-86e6-14892d5f2124");
INSERT INTO DIM_ND
VALUES (200.000000,
150.000000,
"f9c3ec82-219d-4f4c-86e6-14892d5f2124");
INSERT INTO DIM_GE
VALUES (2240.000000,
1344.000000,
"f9c3ec82-219d-4f4c-86e6-14892d5f2124",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
VALUES ("f9c3ec82-219d-4f4c-86e6-14892d5f2124",
0,
"1f51b134-2b1d-4529-91cb-a5458f99aff4");
INSERT INTO DIM_DIA
VALUES ("af703f34-a5d6-467e-ad32-c2fc2af9ed45",
'',
Expand Down Expand Up @@ -713,16 +689,9 @@ INSERT INTO SPR_RS
VALUES ("d9d00089-99ea-429a-9af0-86fc7db383e8",
'setTargetPressed',
'',
'// Find the singleton instance of workout session, and if there is a
// goal currently executing for it, notify it that its execution
// has completed.
select any session from instances of WorkoutSession;
if ( not empty session )
select one goal related by session->Goal[R11.''is currently executing''];
if ( not empty goal )
generate Goal1:Completed to goal;
end if;
end if;',
'// If a goal is currently executing, advance to the next one,
// otherwise start the first specified goal, if it exists.
Goal::nextGoal();',
1);
INSERT INTO C_EP_PROXY
VALUES ("3e2d7574-ba3f-4a52-90c2-6787610b555a",
Expand Down Expand Up @@ -788,15 +757,44 @@ INSERT INTO SPR_REP
"f093414e-3df2-4f9c-a0b4-61ba8e8a6ed9");
INSERT INTO SPR_RO
VALUES ("5f7ab889-a4f4-42b2-b9f0-a27fd3fd8c85",
'setInidicator',
'setIndicator',
'',
'',
3);
1);
INSERT INTO C_EP_PROXY
VALUES ("40870179-79b6-44a6-a9e4-b4e5dd344842",
"06e358bd-8488-4092-af9c-7c359b158f4d",
-1,
'setInidicator',
'setIndicator',
'',
'../../UIInterfaces/UI/UI.xtuml');
INSERT INTO SPR_REP
VALUES ("e38e0ea8-25a0-41da-a405-23297abac860",
"a743f1f4-69fc-421a-b716-6a090a8c2f25",
"f093414e-3df2-4f9c-a0b4-61ba8e8a6ed9");
INSERT INTO SPR_RS
VALUES ("e38e0ea8-25a0-41da-a405-23297abac860",
'newGoalSpec',
'',
'// Create a new goal specification and relate it to the
// singleton instance of workout session if it exists.
select any session from instances of WorkoutSession;
if ( not empty session )
create object instance goalSpec of GoalSpec;
goalSpec.sequenceNumber = param.sequenceNumber;
goalSpec.minimum = param.minimum;
goalSpec.maximum = param.maximum;
goalSpec.span = param.span;
goalSpec.criteriaType = param.criteriaType;
goalSpec.spanType = param.spanType;
relate goalSpec to session across R10.''included in'';
end if;',
1);
INSERT INTO C_EP_PROXY
VALUES ("a743f1f4-69fc-421a-b716-6a090a8c2f25",
"06e358bd-8488-4092-af9c-7c359b158f4d",
-1,
'newGoalSpec',
'',
'../../UIInterfaces/UI/UI.xtuml');
INSERT INTO C_I_PROXY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@ INSERT INTO O_TFR
"ba5eda7a-def5-0000-0000-000000000000",
0,
'// Create and activate an instance of a goal specified by
// the goal specification identified by the incoming parameter.
// the goal specification, if it exists, identified by
// the incoming parameter.

// Find the goal specification for this goal, then
// create and relate this goal to the specification
// and to the singleton workout session.
select any goalSpec from instances of GoalSpec
where ( selected.sequenceNumber == param.sequenceNumber );
create object instance goal of Goal;
relate goal to goalSpec across R9.''specified by'';
select any session from instances of WorkoutSession;
relate goal to session across R11.''is currently executing within'';

// Initialize this goal.
goal.calculateStart();
goal.disposition = GoalDisposition::Increase;

// Start a timer that periodically causes evaluation of goal achievement.
create event instance evaluateEvent of Goal2:Evaluate to goal;
goal.evaluationTimer = TIM::timer_start_recurring( event_inst: evaluateEvent, microseconds: evaluationPeriod );
if ( not empty goalSpec )
create object instance goal of Goal;
relate goal to goalSpec across R9.''specified by'';
select any session from instances of WorkoutSession; // WorkoutSession is a singleton
relate goal to session across R11.''is currently executing within'';

// Initialize this goal.
goal.calculateStart();
goal.disposition = GoalDisposition::Increase;

// Start a timer that periodically causes evaluation of goal achievement.
create event instance evaluateEvent of Goal2:Evaluate to goal;
goal.evaluationTimer = TIM::timer_start_recurring( event_inst: evaluateEvent, microseconds: evaluationPeriod );
end if;

',
1,
Expand Down Expand Up @@ -80,7 +81,7 @@ INSERT INTO O_TFR
"c1022670-c44d-401e-bb23-dfcef6084fba",
'evaluateAchievement',
'',
"e153b5eb-d36e-485d-b6a4-0b55cde4ed29",
"ca91d910-53ec-403c-9551-bfc1a9aa9b73",
1,
'// Based on the type of goal, determine whether this one is
// currently being achieved and return a value indicating
Expand Down Expand Up @@ -114,12 +115,12 @@ return( goalDisposition );',
'',
"b3215204-3d02-48ba-9794-25ddbc40009c");
INSERT INTO S_DT_PROXY
VALUES ("e153b5eb-d36e-485d-b6a4-0b55cde4ed29",
VALUES ("ca91d910-53ec-403c-9551-bfc1a9aa9b73",
"00000000-0000-0000-0000-000000000000",
'GoalDisposition',
'Disposition of a currently executing goal.',
'',
'../../TrackingDataTypes/TrackingDataTypes.xtuml');
'../../../../TrackingDataTypes/TrackingDataTypes.xtuml');
INSERT INTO O_TFR
VALUES ("7090ad22-2865-4836-a89f-a46b868d3ac0",
"c1022670-c44d-401e-bb23-dfcef6084fba",
Expand Down Expand Up @@ -161,6 +162,32 @@ end if;
1,
'',
"2b884ff8-637a-468b-a2fa-f96b8ef98b0a");
INSERT INTO O_TFR
VALUES ("902f97d2-b056-4461-89c5-6454f9f253d7",
"c1022670-c44d-401e-bb23-dfcef6084fba",
'nextGoal',
'',
"ba5eda7a-def5-0000-0000-000000000000",
0,
'// Advance to the next goal or start the first one if one
// is currently not exectuing.

// If there is a goal currently executing, notify it that its execution
// has completed.
// Otherwise, create and start a goal for the first goal specification
// if one exists.
select any session from instances of WorkoutSession; // WorkoutSession is a singleton.
if ( not empty session )
select one goal related by session->Goal[R11.''is currently executing''];
if ( not empty goal )
generate Goal1:Completed to goal;
else
Goal::create( sequenceNumber: GoalSpecOrigin );
end if;
end if;',
1,
'',
"7090ad22-2865-4836-a89f-a46b868d3ac0");
INSERT INTO O_NBATTR
VALUES ("fa9000ac-0495-47fe-bbaf-66bc8f9a4f0a",
"c1022670-c44d-401e-bb23-dfcef6084fba");
Expand All @@ -176,7 +203,7 @@ INSERT INTO O_ATTR
'',
'disposition',
0,
"e153b5eb-d36e-485d-b6a4-0b55cde4ed29",
"ca91d910-53ec-403c-9551-bfc1a9aa9b73",
'',
'');
INSERT INTO O_NBATTR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ INSERT INTO SM_ACT
// whether a timer event was in flight when the timer was cancelled.
cancelSucceeded = TIM::timer_cancel( timer_inst_ref: self.evaluationTimer );

// If this goal has an open achievement record, close it.
select one openAchievement related by self->Achievement[R14.''has open''];
if ( not empty openAchievement )
openAchievement.close();
end if;

// Add this goal to the collection of those that have already executed.
select one session related by self->WorkoutSession[R11.''is currently executing within''];
relate self to session across R13.''was executed within'';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ INSERT INTO O_ATTR
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"1b9ff6a6-df69-4c3f-acfc-6dc3554b1098",
'criteriaType',
'',
'See data type description.',
'',
'criteriaType',
0,
"75257d0c-74e6-4444-9cf1-38d5d764c999",
"cfb9aa72-125a-4d88-9ed9-1af1002d48f0",
'',
'');
INSERT INTO S_DT_PROXY
VALUES ("75257d0c-74e6-4444-9cf1-38d5d764c999",
VALUES ("cfb9aa72-125a-4d88-9ed9-1af1002d48f0",
"00000000-0000-0000-0000-000000000000",
'GoalCriteria',
'The criteria type for a particular workout goal. ',
'',
'../../TrackingDataTypes/TrackingDataTypes.xtuml');
'../../../../TrackingDataTypes/TrackingDataTypes.xtuml');
INSERT INTO O_NBATTR
VALUES ("1d622105-74c9-41c3-8547-4323b5540107",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
Expand All @@ -111,20 +111,20 @@ INSERT INTO O_ATTR
"be6ddd8b-37a5-4534-961b-772bb1d940ac",
"dbe9b50c-a53f-4c36-951b-baea959bb4e7",
'spanType',
'',
'See data type description.',
'',
'spanType',
0,
"1f8a26c0-7ed5-45b6-9d79-279b0e19b00f",
"42487d7d-390d-48d8-a7a5-474cf2d8a900",
'',
'');
INSERT INTO S_DT_PROXY
VALUES ("1f8a26c0-7ed5-45b6-9d79-279b0e19b00f",
VALUES ("42487d7d-390d-48d8-a7a5-474cf2d8a900",
"00000000-0000-0000-0000-000000000000",
'GoalSpan',
'',
'',
'../../TrackingDataTypes/TrackingDataTypes.xtuml');
'../../../../TrackingDataTypes/TrackingDataTypes.xtuml');
INSERT INTO O_NBATTR
VALUES ("f568c69e-b0ba-41ee-aef1-25eb2c07142f",
"be6ddd8b-37a5-4534-961b-772bb1d940ac");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2646,8 +2646,8 @@ INSERT INTO R_SIMP
INSERT INTO R_REL
VALUES ("bc95f1bf-69a4-4013-ab97-58e1c1b23b15",
14,
'Represents an open achievement record, one for which a start time has been recorded
but no end time has yet been recorded. In other words, this association exists only
'Represents an open achievement record, one for which a start time has been recorded
but no end time has yet been recorded. In other words, this association exists only
while the currently executing goal is being achieved.',
"00000000-0000-0000-0000-000000000000");
INSERT INTO R_PART
Expand Down
Loading

0 comments on commit 6de35ab

Please sign in to comment.