Skip to content

Commit

Permalink
Merge pull request #82 from audrey-jardin/main
Browse files Browse the repository at this point in the history
Cleanup and sophisticated unit test for category
  • Loading branch information
lenaRB authored May 2, 2024
2 parents 4842352 + 9142a5c commit 6a3b19f
Show file tree
Hide file tree
Showing 75 changed files with 1,356 additions and 270 deletions.
1,217 changes: 1,185 additions & 32 deletions resources/modelica_libraries/CRML.mo

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

34 changes: 17 additions & 17 deletions resources/modelica_libraries/CRML_test/ETL/Inside/Inside.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public
annotation (Placement(transformation(extent={{12,20},{32,40}})));
CRML.Blocks.Events.EventFilter eventFilter1
annotation (Placement(transformation(extent={{12,-40},{32,-20}})));
CRML.TimeLocators.Attributes.PeriodsStart periodStart
CRML.ETL.TimeLocators.Attributes.PeriodStart periodStart
annotation (Placement(transformation(extent={{-94,-44},{-86,-36}})));
CRML.TimeLocators.Attributes.PeriodsEnd periodEnd
CRML.ETL.TimeLocators.Attributes.PeriodEnd periodEnd
annotation (Placement(transformation(extent={{-84,-52},{-76,-44}})));
CRML.Blocks.Events.Before after_Pstart
annotation (Placement(transformation(extent={{-30,-10},{-10,10}})));
Expand All @@ -31,13 +31,13 @@ public
CRML.Blocks.Events.ClockEvent
eventClock
annotation (Placement(transformation(extent={{74,-10},{94,10}})));
CRML.ETL.Connectors.ClockInput C1
Utilities.ClockConnector C1
annotation (Placement(transformation(extent={{-120,20},{-100,40}})));
CRML.Blocks.Events.ClockToBoolean clockToBoolean
annotation (Placement(transformation(extent={{-84,26},{-76,34}})));
CRML.ETL.Connectors.TimeLocatorInput P1
Utilities.TimeLocatorConnector P1
annotation (Placement(transformation(extent={{-120,-40},{-100,-20}})));
Modelica.Clocked.BooleanSignals.Sampler.Hold hold2
CRML.Blocks.Logical.Hold hold
annotation (Placement(transformation(extent={{-62,24},{-50,36}})));
equation
connect(boolean4Constant.y, after_Pstart.strictlyBefore)
Expand Down Expand Up @@ -68,24 +68,24 @@ equation
color={175,175,175},
pattern=LinePattern.Dot,
thickness=0.5));
connect(P1, periodStart.tl[1]) annotation (Line(points={{-110,-30},{-90,-30},
{-90,-36}}, color={0,0,255}));
connect(periodEnd.tl[1], P1) annotation (Line(points={{-80,-44},{-80,-30},{
-110,-30}}, color={0,0,255}));
connect(clockToBoolean.y, hold2.u)
connect(clockToBoolean.y, hold.u)
annotation (Line(points={{-75.2,30},{-63.2,30}}, color={217,67,180}));
connect(periodEnd.y, before_Pend.u2)
annotation (Line(points={{-75.6,-48},{-31,-48}}, color={217,67,180}));
connect(eventFilter.u, hold2.y)
connect(eventFilter.u, hold.y)
annotation (Line(points={{11,30},{-49.4,30}}, color={217,67,180}));
connect(eventFilter1.u, hold2.y) annotation (Line(points={{11,-30},{0,-30},{0,
30},{-49.4,30}}, color={217,67,180}));
connect(eventFilter1.u, hold.y) annotation (Line(points={{11,-30},{0,-30},{0,30},
{-49.4,30}}, color={217,67,180}));
connect(periodStart.y, after_Pstart.u1) annotation (Line(points={{-85.6,-40},
{-82,-40},{-82,-20},{-48,-20},{-48,8},{-31,8}}, color={217,67,180}));
connect(after_Pstart.u2, hold2.y) annotation (Line(points={{-31,-8},{-40,-8},
{-40,30},{-49.4,30}}, color={217,67,180}));
connect(before_Pend.u1, hold2.y) annotation (Line(points={{-31,-32},{-40,-32},
{-40,30},{-49.4,30}}, color={217,67,180}));
connect(after_Pstart.u2, hold.y) annotation (Line(points={{-31,-8},{-40,-8},{-40,
30},{-49.4,30}}, color={217,67,180}));
connect(before_Pend.u1, hold.y) annotation (Line(points={{-31,-32},{-40,-32},{
-40,30},{-49.4,30}}, color={217,67,180}));
connect(periodStart.tl, P1) annotation (Line(points={{-90,-36},{-90,-30},{-110,
-30}}, color={0,0,255}));
connect(periodEnd.tl, P1) annotation (Line(points={{-80,-44},{-80,-30},{-110,-30}},
color={0,0,255}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end Inside;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within CRML_test.ETL.Inside;
model Inside2_verif
extends Inside2;
Inside2_externals externals
annotation (Placement(transformation(extent={{-200,0},{-140,60}})));
annotation (Placement(transformation(extent={{-200,20},{-140,80}})));
equation
// Bindings
b1 = externals.b1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Inside
Inside_externals
Inside_verif
Inside2
Inside2_externals
Inside2_verif
Inside

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions resources/modelica_libraries/CRML_test/ETL/package.order

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion resources/modelica_libraries/CRML_test/FORML/package.order

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions resources/modelica_libraries/CRML_test/Spec_doc/package.order

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions resources/modelica_libraries/CRML_test/Temp/package.order

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions resources/modelica_libraries/CRML_test/package.order

This file was deleted.

11 changes: 5 additions & 6 deletions src/test/resources/testModels/libraries/ETL_test/CheckOver.crml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
model CheckOver is {
// Operators on Boolean
// Logical disjunction
Template b1 'or' b2 = not (not b1 and not b2);

// Decide
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end);
// Option1
// Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi or (P end); //With or defined as the built-in disjunction operator
// Option2
Template b1 'or' b2 = not (not b1 and not b2);
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' new Boolean (P end); //With 'or' as a user-defined disjunction operator for Booleans (only)

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

// Operators for the evaluation of requirements
// Check
Operator [ Boolean ] 'check' Boolean phi 'over' Periods P
= and ('evaluate' phi 'over' P);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
model CheckOver_no_ext is {
// Operators on Boolean
// Logical disjunction
Template b1 'or' b2 = not (not b1 and not b2);

// Decide
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' (P end);
// Option1
// Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi or (P end); //With or defined as the built-in disjunction operator
// Option2
Template b1 'or' b2 = not (not b1 and not b2);
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' new Boolean (P end); //With 'or' as a user-defined disjunction operator for Booleans (only)

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

// Operators for the evaluation of requirements
// Check
Operator [ Boolean ] 'check' Boolean phi 'over' Periods P
= and ('evaluate' phi 'over' P);
Expand All @@ -20,5 +19,5 @@ model CheckOver_no_ext is {
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 b_check_over is 'evaluate' phi1 'over' P1; //Value is undefined, becomes undecided at 2.5s and then false at t=3.5s
Boolean b_check_over is 'check' phi1 'over' P1; //Value is undefined, becomes undecided at 2.5s and then false at t=3.5s
};
13 changes: 5 additions & 8 deletions src/test/resources/testModels/libraries/ETL_test/DecideOver.crml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
model DecideOver is {
// Operators on Boolean
// 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);
// Option1
// Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi or (P end); //With or defined as the built-in disjunction operator
// Option2
Template b1 'or' b2 = not (not b1 and not b2);
Operator [ Boolean ] 'decide' Boolean phi 'over' Period P = phi 'or' new Boolean (P end); //With 'or' as a user-defined disjunction operator for Booleans (only)

// Example of function call
Boolean phi1 is external;
Expand Down
Loading

0 comments on commit 6a3b19f

Please sign in to comment.