Skip to content

Commit

Permalink
Merge pull request #50 from lenaRB/ETL-translation-fix
Browse files Browse the repository at this point in the history
Editing the ETL examples so they pass the translation phase
  • Loading branch information
lenaRB committed Dec 13, 2023
2 parents 420c047 + f5cfc6b commit afbf354
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 26 deletions.
14 changes: 7 additions & 7 deletions src/test/resources/testModels/libraries/ETL_test/CheckOver.crml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ model CheckOver is {
// Operators on Boolean
// Logical disjunction
Template b1 'or' b2 = not (not b1 and not b2);

// Operators for the evaluation of requirements
// Check
Operator [ Boolean ] 'check' Boolean phi 'over' Periods P
= and ('evaluate' phi 'over' P);

// Decide
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end);

// Evaluate
Operator [ Boolean ] 'evaluate' Boolean phi 'over' Period P
= integrate (('decide' phi 'over' P) * phi) on P;

// Decide
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end));
// Operators for the evaluation of requirements
// Check
Operator [ Boolean ] 'check' Boolean phi 'over' Periods P
= and ('evaluate' phi 'over' P);

// Example of function call
Boolean phi1 is external;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ model CheckOver_no_ext is {
// Logical disjunction
Template b1 'or' b2 = not (not b1 and not b2);

// Operators for the evaluation of requirements
// Check
Operator [ Boolean ] 'check' Boolean phi 'over' Periods P
= and ('evaluate' phi 'over' P);
// Decide
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end);

// Evaluate
Operator [ Boolean ] 'evaluate' Boolean phi 'over' Period P
= integrate (('decide' phi 'over' P) * phi) on P;

// Decide
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end));

// Operators for the evaluation of requirements
// Check
Operator [ Boolean ] 'check' Boolean phi 'over' Periods P
= and ('evaluate' phi 'over' P);

// Example of function call
Boolean phi1 is if 2.0 < time and time < 3.5 then true else false;
Boolean b1 is if 2.5 < time and time < 5 then undecided else false;
Boolean phi1 is if (2.0 < time) and (time < 3.5) then true else false;
Boolean b1 is if (2.5 < time) and (time < 5) then undecided else false;
Period P1 is [new Event b1, new Event not b1];

Boolean b_check_over is 'evaluate' phi1 'over' P1; //Value is undefined, becomes undecided at 2.5s and then false at t=3.5s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ model CountInside_no_ext is {
Operator [ Integer ] 'count' Clock C 'inside' Period P = card (C 'inside' P);

// Example of function call
Boolean b1 is if 2.5 < time and time < 5 then true else false;
Boolean b1 is if (2.5 < time) and (time < 5) then true else false;
Period P1 is [ b1, not b1 ];
Boolean b2 is if (2 < time and time < 3) or (3.5 < time and time < 4.5) then true else false;
Boolean b2 is if ((2 < time) and (time < 3)) or ((3.5 < time) and (time < 4.5)) then true else false;
Clock C1 is new Clock b2;

Integer i_count_ticks_of_c1_inside_p1 is 'count' C1 'inside' P1; // Value should be 1 (there is only one tick of C1 inside Period P1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ model DecideOver is {
// Logical disjunction
Template b1 'or' b2 = not (not b1 and not b2);



// Decide
//Operator 'decide' is
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ model DecideOver_no_ext is {
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end));

// Example of function call
Boolean phi1 is if 2.0 < time and time < 3.5 then true else false;
Boolean b1 is if 2.5 < time and time < 5 then undecided else false;
Boolean phi1 is if (2.0 < time) and (time < 3.5) then true else false;
Boolean b1 is if (2.5 < time) and (time < 5) then undecided else false;
Period P1 is [ new Event b1, new Event not b1];

Boolean b_decide_over is 'decide' phi1 'over' P1; //Value is undecided and becomes false at t=3.5s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ model EvaluateOver_no_ext is {
= integrate (('decide' phi 'over' P) * phi) on P;

// Example of function call
Boolean phi1 is if 2.0 < time and time < 3.5 then true else false;
Boolean b1 is if 2.5 < time and time < 5 then undecided else false;
Boolean phi1 is if (2.0 < time) and (time < 3.5) then true else false;
Boolean b1 is if (2.5 < time) and (time < 5) then undecided else false;
Period P1 is [ new Event b1, new Event not b1];

Boolean b_evaluate_over is 'evaluate' phi1 'over' P1; //Value is undefined, becomes undecided at 2.5s and then false at t=3.5s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ model Inside_no_ext is {
= C filter ((tick C >= P start) and (tick C <= P end));

// Example of function call
Boolean b1 is if 2.5 < time and time < 5 then true else false;
Boolean b1 is if (2.5 < time) and (time < 5) then true else false;
Period P1 is [ new Event b1, new Event not b1 ];
Boolean b2 is if (2 < time and time < 3) or (3.5 < time and time < 4.5) then true else false;
Boolean b2 is if ((2 < time) and (time < 3)) or ((3.5 < time) and (time < 4.5)) then true else false;
Clock C1 is new Clock b2;

Clock c_filtered_ticks_of_c1_inside_p1 is C1 'inside' P1; // Only one event should be kept at instant 3.5 s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
model EnsureAtEnd is ETL union {


// Operator for checking that a requirement is satisfied at the end of a time period
Operator [ Boolean ] 'check' Boolean b 'at end of' Periods P = 'check' varying1 'id' b 'over' P;

// Requirement
Boolean y is 'check' u 'at end of' {timePeriod};

// Inputs
Event e1 is external;
Event e2 is external;
Boolean u is external;
Period timePeriod is ] e1, e2 [;

// Requirement
Boolean y is 'check' u 'at end of' {timePeriod};

};

0 comments on commit afbf354

Please sign in to comment.