diff --git a/resources/modelica_libraries/CRML.mo b/resources/modelica_libraries/CRML.mo index d0686b5..609a3a6 100644 --- a/resources/modelica_libraries/CRML.mo +++ b/resources/modelica_libraries/CRML.mo @@ -461,7 +461,7 @@ into your model. ETL.Connectors.WhileInput tl "Master time period" annotation( Placement(transformation(extent = {{-10, 90}, {10, 110}}))); ETL.Connectors.RealInput duration "Duration" annotation( - Placement(transformation(extent = {{-120, -90}, {-100, -70}}), visible = not periods.durationSpecified)); + Placement(transformation(extent = {{-120, -90}, {-100, -70}}), visible = periods.durationSpecified)); public ETL.Connectors.TimeLocatorOutput[N] y(timePeriod(each fixed = true, each start = false)) "Vector of time periods" annotation( Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -100}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -100}))); @@ -5038,12 +5038,13 @@ which is only valid in the rotor-fixed coordinate system. // fillColor={28,108,200}, // fillPattern=FillPattern.Solid, // textString=boxName), - connect(evaluateOver.tl, tl) annotation( - Line(points = {{0, 10}, {0, 100}}, color = {0, 0, 255})); connect(evaluateOver.u, boolean4Replicator.y) annotation( Line(points = {{-11, 0}, {-39, 0}}, color = {162, 29, 33})); connect(evaluateOver.y, and4.u) annotation( Line(points = {{11, 0}, {39, 0}}, color = {162, 29, 33})); + connect( + evaluateOver.tl, tl) annotation ( + Line(points = {{0, 10}, {0, 100}}, color = {0, 0, 255}, thickness = 0.5)); annotation( Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, fillColor = {162, 29, 33}, lineThickness = 5, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised, lineColor = {0, 0, 0}), Rectangle(extent = {{-78, 80}, {82, -80}}, lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-70, 72}, {70, 44}}, lineColor = {28, 108, 200}, textString = "check"), Text(extent = {{-70, 18}, {70, -10}}, lineColor = {28, 108, 200}, textString = "over")}), Diagram(coordinateSystem(preserveAspectRatio = false)), @@ -8987,7 +8988,6 @@ unvailability should be less of 1 hour in a sliding time period of one month record CRMLClock //constant Integer buffer_size=50; // number of events that can be logged - CRML.ETL.Types.Boolean4 b( start= CRML.ETL.Types.Boolean4.false4); Real ticks[50](each start = -1, each fixed = true); diff --git a/resources/modelica_libraries/CRML_test/ETL/CheckOver/CheckOver.mo b/resources/modelica_libraries/CRML_test/ETL/CheckOver/CheckOver.mo index 8512cda..d0c0c29 100644 --- a/resources/modelica_libraries/CRML_test/ETL/CheckOver/CheckOver.mo +++ b/resources/modelica_libraries/CRML_test/ETL/CheckOver/CheckOver.mo @@ -1,10 +1,5 @@ within CRML_test.ETL.CheckOver; partial block CheckOver - -protected - parameter Integer N=CRML.ETL.Types.nMaxOverlap; - -public Utilities.Boolean4Connector phi1 "Boolean4 condition" annotation (Placement( transformation(extent={{-120,-10},{-100,10}}), iconTransformation( extent={{-120,-10},{-100,10}}))); @@ -13,29 +8,23 @@ public 110}}))); CRML.ETL.Connectors.Boolean4Output b_check_over annotation (Placement(transformation(extent={{100,-10},{120,10}}))); - CRML.Blocks.Logical4.And4_n and4(N=N) - annotation (Placement(transformation(extent={{40,-10},{60,10}}))); - CRML.Blocks.Routing.Boolean4Replicator boolean4Replicator(nout=N) - annotation (Placement(transformation(extent={{-60,-10},{-40,10}}))); - CRML.ETL.Requirements.EvaluateOver[N] evaluateOver - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + CRML.ETL.Requirements.CheckOver checkOver annotation( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; equation - connect(phi1, boolean4Replicator.u) - annotation (Line(points={{-110,0},{-62,0}}, color={162,29,33})); - connect(and4.y, b_check_over) - annotation (Line(points={{61,0},{110,0}}, color={162,29,33})); // Text( // extent={{-74,32},{74,-36}}, // lineColor={0,0,0}, // fillColor={28,108,200}, // fillPattern=FillPattern.Solid, // textString=boxName), - connect(evaluateOver.tl, P1) - annotation (Line(points={{0,10},{0,100}}, color={0,0,255})); - connect(evaluateOver.u, boolean4Replicator.y) - annotation (Line(points={{-11,0},{-39,0}}, color={162,29,33})); - connect(evaluateOver.y, and4.u) - annotation (Line(points={{11,0},{39,0}}, color={162,29,33})); + connect(checkOver.y, b_check_over) annotation( + Line(points = {{12, 0}, {110, 0}}, color = {162, 29, 33})); + connect(checkOver.tl, P1) annotation( + Line(points = {{0, 10}, {0, 100}}, color = {0, 0, 255}, thickness = 0.5)); + connect(checkOver.u, phi1) annotation( + Line(points = {{-10, 0}, {-110, 0}}, color = {162, 29, 33})); annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Rectangle( extent={{-100,100},{100,-100}}, diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore.mo new file mode 100644 index 0000000..8de3f7e --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore.mo @@ -0,0 +1,69 @@ +within CRML_test.FORML.AfterBefore; +block AfterBefore +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation( + Placement(transformation(extent = {{-120, 30}, {-100, 50}}), iconTransformation(extent = {{-120, 30}, {-100, 50}}))); + CRML.ETL.Connectors.WhileInput tl annotation( + Placement(transformation(extent = {{-10, 90}, {10, 110}}), iconTransformation(extent = {{-10, 90}, {10, 110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_before_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); + CRML.ETL.TimeLocators.Periods periods(leftBoundaryIncluded = false, rightBoundaryIncluded = false) annotation( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 annotation( + Placement(transformation(extent = {{-80, 30}, {-60, 50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 annotation( + Placement(transformation(extent = {{-44, 36}, {-36, 44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 annotation( + Placement(transformation(extent = {{-80, -50}, {-60, -30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 annotation( + Placement(transformation(extent = {{-44, -44}, {-36, -36}}))); + +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation( + Placement(transformation(extent={{-120,-50},{-100,-30}}), iconTransformation(extent={{-120, + -50},{-100,-30}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + connect(ck1, clockToBoolean_ck1.u) annotation( + Line(points = {{-110, 40}, {-82, 40}}, color = {175, 175, 175}, pattern = LinePattern.Dot, thickness = 0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) annotation( + Line(points = {{-59, 40}, {-44.4, 40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck1.y, periods.u1) annotation( + Line(points = {{-35.6, 40}, {-20, 40}, {-20, 0}, {-11, 0}}, color = {162, 29, 33})); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) annotation( + Line(points = {{-59, -40}, {-44.4, -40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck2.y, periods.u2) annotation( + Line(points = {{-35.6, -40}, {-20, -40}, {-20, -8}, {-11, -8}}, color = {162, 29, 33})); + connect(periods.y, p_after_b1_before_b2) annotation (Line(points={{0,-10},{0,-20}, + {80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, periods.tl) annotation( + Line(points = {{0, 100}, {0, 10}}, color = {0, 0, 255})); + connect(clockToBoolean_ck2.u, ck2) annotation (Line( + points={{-82,-40},{-110,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation( + Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Rectangle(fillColor = {85, 170, 255}, fillPattern = FillPattern.Solid, lineThickness = 5, borderPattern = BorderPattern.Raised, extent = {{-100, 100}, {100, -100}}), Rectangle(lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-70, 30}, {70, -52}}), Line(points = {{-50, -34}, {-50, -12}}, pattern = LinePattern.Dash), Line(points = {{-48, -12}, {52, -12}}, pattern = LinePattern.Dash), Line(points = {{52, -12}, {52, -34}}, pattern = LinePattern.Dash), Line(points = {{-62, -34}, {58, -34}}, color = {175, 175, 175}), Line(points = {{-50, -12}, {-50, 10}}, pattern = LinePattern.Dash), Rectangle(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, extent = {{22, 2}, {52, -12}}), Line(points = {{-50, 10}, {22, 10}}, pattern = LinePattern.Dash), Line(points = {{22, 10}, {22, -12}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {20, -10}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {24, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-52, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-48, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, 30}, {-70, 30}, {-70, -52}, {-50, -52}}), Line(points = {{50, 30}, {70, 30}, {70, -52}, {50, -52}}), Text(textColor = {175, 175, 175}, extent = {{-28, -10}, {22, -34}}, textString = "%u"), Text(extent = {{-78, 86}, {76, 38}}, textString = "after before")}), + Diagram(coordinateSystem(preserveAspectRatio = false)), + Documentation(info = " +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end AfterBefore; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore2.mo new file mode 100644 index 0000000..db552b0 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore2.mo @@ -0,0 +1,96 @@ +within CRML_test.FORML.AfterBefore; +block AfterBefore2 + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; + +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,30},{-100,50}}), iconTransformation(extent={{-120,30}, + {-100,50}}))); + CRML.ETL.Connectors.WhileInput tl annotation (Placement( + transformation(extent={{-10,90},{10,110}}), iconTransformation(extent={ + {-10,90},{10,110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_before_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,-50},{-100,-30}}), iconTransformation( + extent={{-120,-50},{-100,-30}}))); + CRML.TimeLocators.Continuous.AfterBefore + afterBefore + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 + annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 + annotation (Placement(transformation(extent={{-44,36},{-36,44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 + annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 + annotation (Placement(transformation(extent={{-44,-44},{-36,-36}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + + connect(ck1, clockToBoolean_ck1.u) annotation (Line( + points={{-110,40},{-110,40},{-110,40},{-82,40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) + annotation (Line(points={{-59,40},{-44.4,40}}, color={255,0,255})); + connect(booleanToBoolean4_ck1.y, afterBefore.u1) annotation (Line(points={{-35.6, + 40},{-20,40},{-20,0},{-11,0}}, color={162,29,33})); + connect(ck2, clockToBoolean_ck2.u) annotation (Line( + points={{-110,-40},{-82,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) + annotation (Line(points={{-59,-40},{-44.4,-40}}, color={255,0,255})); + connect(booleanToBoolean4_ck2.y, afterBefore.u2) annotation (Line(points={{-35.6, + -40},{-20,-40},{-20,-8},{-11,-8}}, color={162,29,33})); + connect(afterBefore.y, p_after_b1_before_b2) annotation (Line(points={{0,-10}, + {0,-20},{80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, afterBefore.tl) + annotation (Line(points={{0,100},{0,10}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle(extent={{-100, + 100},{100,-100}}, fillColor = {85, 170, 255}, lineThickness = 5, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised, lineColor = {0, 0, 0}), Rectangle(extent={{-70,30}, + {70,-52}}, lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points={{-50,-34}, + {-50,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-48,-12}, + {52,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{52,-12}, + {52,-34}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-62,-34}, + {58,-34}}, color = {175, 175, 175}), Line(points={{-50,-12}, + {-50,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Rectangle(extent={{22,2},{ + 52,-12}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Line(points={{-50,10}, + {22,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,10}, + {22,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {20,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {24,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-52,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-48,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,30}, + {-70,30},{-70,-52},{-50,-52}}, color = {0, 0, 0}), Line(points={{50,30}, + {70,30},{70,-52},{50,-52}}, color = {0, 0, 0}), Text(extent={{-28,-10}, + {22,-34}}, lineColor = {175, 175, 175}, pattern = LinePattern.Dash, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "%u"), Text(extent={{-78,86}, + {76,38}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "after before")}), + Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end AfterBefore2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_externals.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_externals.mo new file mode 100644 index 0000000..be4f972 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_externals.mo @@ -0,0 +1,43 @@ +within CRML_test.FORML.AfterBefore; +model AfterBefore_externals + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-60,50},{-40,70}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); + CRML.ETL.Connectors.ClockOutput ck1 + annotation (Placement(transformation(extent={{100,40},{120,60}}))); + CRML.ETL.Connectors.ClockOutput ck2 + annotation (Placement(transformation(extent={{100,-80},{120,-60}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-6,54},{6,66}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-6,-66},{6,-54}}))); +equation + connect(b1.y, clockEvent_1.u) + annotation (Line(points={{-39,60},{-6.6,60}}, color={217,67,180})); + connect(clockEvent_1.y, ck1) annotation (Line( + points={{6.6,60},{40,60},{40,50},{110,50}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(b2.y, clockEvent_2.u) + annotation (Line(points={{-39,-60},{-6.6,-60}}, color={217,67,180})); + connect(clockEvent_2.y, ck2) annotation (Line( + points={{6.6,-60},{40,-60},{40,-70},{110,-70}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end AfterBefore_externals; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_verif.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_verif.mo new file mode 100644 index 0000000..3e7cc59 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_verif.mo @@ -0,0 +1,21 @@ +within CRML_test.FORML.AfterBefore; +model AfterBefore_verif + AfterBefore_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + AfterBefore afterBefore + annotation (Placement(transformation(extent={{0,0},{20,20}}))); +equation + // Bindings + externals.ck1 = afterBefore.ck1; + externals.ck2 = afterBefore.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,60},{64,0},{-36,-60},{-36,60}})})); +end AfterBefore_verif; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_verif2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_verif2.mo new file mode 100644 index 0000000..479b951 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/AfterBefore_verif2.mo @@ -0,0 +1,22 @@ +within CRML_test.FORML.AfterBefore; +model AfterBefore_verif2 + + AfterBefore_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + AfterBefore2 afterBefore2 + annotation (Placement(transformation(extent={{-26,16},{-6,36}}))); +equation + // Bindings + externals.ck1 = afterBefore2.ck1; + externals.ck2 = afterBefore2.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-102},{100,98}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,58},{64,-2},{-36,-62},{-36,58}})})); +end AfterBefore_verif2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/package.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/package.mo new file mode 100644 index 0000000..cbdced7 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package AfterBefore +end AfterBefore; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore/package.order b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/package.order new file mode 100644 index 0000000..0aa4531 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore/package.order @@ -0,0 +1,5 @@ +AfterBefore +AfterBefore2 +AfterBefore_externals +AfterBefore_verif +AfterBefore_verif2 diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/AfterBefore_no_ext.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/AfterBefore_no_ext.mo new file mode 100644 index 0000000..2faefc0 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/AfterBefore_no_ext.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.AfterBefore_no_ext; +model AfterBefore_no_ext +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + AfterBefore.AfterBefore afterBefore + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_until_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_2.y, afterBefore.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_1.y, afterBefore.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(afterBefore.p_after_b1_before_b2, p_after_b1_until_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end AfterBefore_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/AfterBefore_no_ext2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/AfterBefore_no_ext2.mo new file mode 100644 index 0000000..b12cda8 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/AfterBefore_no_ext2.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.AfterBefore_no_ext; +model AfterBefore_no_ext2 +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + AfterBefore.AfterBefore2 afterBefore2_1 + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_until_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_2.y, afterBefore2_1.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_1.y, afterBefore2_1.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(afterBefore2_1.p_after_b1_before_b2, p_after_b1_until_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end AfterBefore_no_ext2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/package.mo b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/package.mo new file mode 100644 index 0000000..fa39504 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package AfterBefore_no_ext +end AfterBefore_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/package.order b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/package.order new file mode 100644 index 0000000..558f001 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterBefore_no_ext/package.order @@ -0,0 +1,2 @@ +AfterBefore_no_ext +AfterBefore_no_ext2 diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor2.mo new file mode 100644 index 0000000..37ddad9 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor2.mo @@ -0,0 +1,85 @@ +within CRML_test.FORML.AfterFor; +block AfterFor2 + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; + +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,30},{-100,50}}), iconTransformation(extent={{-120,30}, + {-100,50}}))); + CRML.ETL.Connectors.WhileInput tl annotation (Placement( + transformation(extent={{-10,90},{10,110}}), iconTransformation(extent={ + {-10,90},{10,110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_for_d1 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); +public + CRML.ETL.Connectors.RealInput d1 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,-50},{-100,-30}}), iconTransformation( + extent={{-120,-50},{-100,-30}}))); + CRML.TimeLocators.Continuous.AfterFor + afterFor + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 + annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 + annotation (Placement(transformation(extent={{-44,36},{-36,44}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + + connect(ck1, clockToBoolean_ck1.u) annotation (Line( + points={{-110,40},{-110,40},{-110,40},{-82,40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) + annotation (Line(points={{-59,40},{-44.4,40}}, color={255,0,255})); + connect(afterFor.y, p_after_b1_for_d1) annotation (Line(points={{0,-10},{0,-20}, + {80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, afterFor.tl) + annotation (Line(points={{0,100},{0,10}}, color={0,0,255})); + connect(booleanToBoolean4_ck1.y, afterFor.u) annotation (Line(points={{-35.6, + 40},{-16,40},{-16,0},{-11,0}}, color={162,29,33})); + connect(d1, afterFor.duration) annotation (Line(points={{-110,-40},{-16,-40}, + {-16,-8},{-11,-8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle(extent={{-100, + 100},{100,-100}}, fillColor = {85, 170, 255}, lineThickness = 5, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised, lineColor = {0, 0, 0}), Rectangle(extent={{-70,30}, + {70,-52}}, lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points={{-50,-34}, + {-50,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-48,-12}, + {52,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{52,-12}, + {52,-34}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-62,-34}, + {58,-34}}, color = {175, 175, 175}), Line(points={{-50,-12}, + {-50,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Rectangle(extent={{22,2},{ + 52,-12}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Line(points={{-50,10}, + {22,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,10}, + {22,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {20,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {24,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-52,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-48,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,30}, + {-70,30},{-70,-52},{-50,-52}}, color = {0, 0, 0}), Line(points={{50,30}, + {70,30},{70,-52},{50,-52}}, color = {0, 0, 0}), Text(extent={{-28,-10}, + {22,-34}}, lineColor = {175, 175, 175}, pattern = LinePattern.Dash, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "%u"), Text(extent={{-78,86}, + {76,38}}, lineColor = {0, 0, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "after before")}), + Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end AfterFor2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_externals.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_externals.mo new file mode 100644 index 0000000..a841b6a --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_externals.mo @@ -0,0 +1,33 @@ +within CRML_test.FORML.AfterFor; +model AfterFor_externals + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5}) + annotation (Placement(transformation(extent={{-60,50},{-40,70}}))); + CRML.Blocks.Math.Constant duration(k=3) + annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); + CRML.ETL.Connectors.ClockOutput ck1 + annotation (Placement(transformation(extent={{100,40},{120,60}}))); + CRML.ETL.Connectors.RealOutput d1 + annotation (Placement(transformation(extent={{100,-80},{120,-60}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-6,54},{6,66}}))); +equation + connect(b1.y, clockEvent_1.u) + annotation (Line(points={{-39,60},{-6.6,60}}, color={217,67,180})); + connect(clockEvent_1.y, ck1) annotation (Line( + points={{6.6,60},{40,60},{40,50},{110,50}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(duration.y, d1) annotation (Line(points={{-39,-60},{94,-60},{94,-70}, + {110,-70}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end AfterFor_externals; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_verif.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_verif.mo new file mode 100644 index 0000000..7fe13c0 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_verif.mo @@ -0,0 +1,21 @@ +within CRML_test.FORML.AfterFor; +model AfterFor_verif + AfterFor_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + AfterFor_wip afterFor + annotation (Placement(transformation(extent={{0,0},{20,20}}))); +equation + // Bindings + externals.ck1 =afterFor.ck1; + externals.d1 = afterFor.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,60},{64,0},{-36,-60},{-36,60}})})); +end AfterFor_verif; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_verif2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_verif2.mo new file mode 100644 index 0000000..83d31f7 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_verif2.mo @@ -0,0 +1,22 @@ +within CRML_test.FORML.AfterFor; +model AfterFor_verif2 + + AfterFor_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + AfterFor2 afterFor2 + annotation (Placement(transformation(extent={{-26,16},{-6,36}}))); +equation + // Bindings + externals.ck1 =afterFor2.ck1; + externals.d1 = afterFor2.d1; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-102},{100,98}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,58},{64,-2},{-36,-62},{-36,58}})})); +end AfterFor_verif2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_wip.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_wip.mo new file mode 100644 index 0000000..7223fec --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/AfterFor_wip.mo @@ -0,0 +1,69 @@ +within CRML_test.FORML.AfterFor; +block AfterFor_wip +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation( + Placement(transformation(extent = {{-120, 30}, {-100, 50}}), iconTransformation(extent = {{-120, 30}, {-100, 50}}))); + CRML.ETL.Connectors.WhileInput tl annotation( + Placement(transformation(extent = {{-10, 90}, {10, 110}}), iconTransformation(extent = {{-10, 90}, {10, 110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_for_d1 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); + CRML.ETL.TimeLocators.Periods periods(leftBoundaryIncluded = false, rightBoundaryIncluded = false) annotation( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 annotation( + Placement(transformation(extent = {{-80, 30}, {-60, 50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 annotation( + Placement(transformation(extent = {{-44, 36}, {-36, 44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 annotation( + Placement(transformation(extent = {{-80, -50}, {-60, -30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 annotation( + Placement(transformation(extent = {{-44, -44}, {-36, -36}}))); + +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation( + Placement(transformation(extent={{-120,-50},{-100,-30}}), iconTransformation(extent={{-120, + -50},{-100,-30}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + connect(ck1, clockToBoolean_ck1.u) annotation( + Line(points = {{-110, 40}, {-82, 40}}, color = {175, 175, 175}, pattern = LinePattern.Dot, thickness = 0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) annotation( + Line(points = {{-59, 40}, {-44.4, 40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck1.y, periods.u1) annotation( + Line(points = {{-35.6, 40}, {-20, 40}, {-20, 0}, {-11, 0}}, color = {162, 29, 33})); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) annotation( + Line(points = {{-59, -40}, {-44.4, -40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck2.y, periods.u2) annotation( + Line(points = {{-35.6, -40}, {-20, -40}, {-20, -8}, {-11, -8}}, color = {162, 29, 33})); + connect(periods.y, p_after_b1_for_d1) annotation (Line(points={{0,-10},{0,-20}, + {80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, periods.tl) annotation( + Line(points = {{0, 100}, {0, 10}}, color = {0, 0, 255})); + connect(clockToBoolean_ck2.u, ck2) annotation (Line( + points={{-82,-40},{-110,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation( + Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Rectangle(fillColor = {85, 170, 255}, fillPattern = FillPattern.Solid, lineThickness = 5, borderPattern = BorderPattern.Raised, extent = {{-100, 100}, {100, -100}}), Rectangle(lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-70, 30}, {70, -52}}), Line(points = {{-50, -34}, {-50, -12}}, pattern = LinePattern.Dash), Line(points = {{-48, -12}, {52, -12}}, pattern = LinePattern.Dash), Line(points = {{52, -12}, {52, -34}}, pattern = LinePattern.Dash), Line(points = {{-62, -34}, {58, -34}}, color = {175, 175, 175}), Line(points = {{-50, -12}, {-50, 10}}, pattern = LinePattern.Dash), Rectangle(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, extent = {{22, 2}, {52, -12}}), Line(points = {{-50, 10}, {22, 10}}, pattern = LinePattern.Dash), Line(points = {{22, 10}, {22, -12}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {20, -10}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {24, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-52, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-48, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, 30}, {-70, 30}, {-70, -52}, {-50, -52}}), Line(points = {{50, 30}, {70, 30}, {70, -52}, {50, -52}}), Text(textColor = {175, 175, 175}, extent = {{-28, -10}, {22, -34}}, textString = "%u"), Text(extent = {{-78, 86}, {76, 38}}, textString = "after before")}), + Diagram(coordinateSystem(preserveAspectRatio = false)), + Documentation(info = " +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end AfterFor_wip; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/package.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor/package.mo new file mode 100644 index 0000000..f8b61c1 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package AfterFor +end AfterFor; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor/package.order b/resources/modelica_libraries/CRML_test/FORML/AfterFor/package.order new file mode 100644 index 0000000..bb9892d --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor/package.order @@ -0,0 +1,5 @@ +AfterFor_wip +AfterFor2 +AfterFor_externals +AfterFor_verif +AfterFor_verif2 diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/AfterFor_no_ext2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/AfterFor_no_ext2.mo new file mode 100644 index 0000000..0306c5d --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/AfterFor_no_ext2.mo @@ -0,0 +1,33 @@ +within CRML_test.FORML.AfterFor_no_ext; +model AfterFor_no_ext2 +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + AfterFor.AfterFor2 afterFor2 + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_for_d1 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5}) + annotation (Placement(transformation(extent={{-80,50},{-60,70}}))); + CRML.Blocks.Math.Constant duration(k=3) + annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,54},{-14,66}}))); +equation + + connect(afterFor2.p_after_b1_for_d1, p_after_b1_for_d1) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,60},{-26.6,60}},color={217,67,180})); + connect(clockEvent_1.y, afterFor2.ck1) annotation (Line( + points={{-13.4,60},{12,60},{12,4},{39,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(duration.y, afterFor2.d1) annotation (Line(points={{-59,-60},{34,-60}, + {34,-4},{39,-4}}, color={0,0,0})); +end AfterFor_no_ext2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/AfterFor_no_ext_wip.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/AfterFor_no_ext_wip.mo new file mode 100644 index 0000000..88d771c --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/AfterFor_no_ext_wip.mo @@ -0,0 +1,31 @@ +within CRML_test.FORML.AfterFor_no_ext; +model AfterFor_no_ext_wip +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + AfterFor.AfterFor_wip afterFor + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_for_d1 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5}) + annotation (Placement(transformation(extent={{-80,50},{-60,70}}))); + CRML.Blocks.Math.Constant duration(k=3) + annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,54},{-14,66}}))); +equation + + connect(afterFor.p_after_b1_for_d1, p_after_b1_for_d1) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,60},{-26.6,60}},color={217,67,180})); + connect(clockEvent_1.y, afterFor.ck1) annotation (Line( + points={{-13.4,60},{18,60},{18,0},{39,0},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); +end AfterFor_no_ext_wip; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/package.mo b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/package.mo new file mode 100644 index 0000000..b39ada5 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package AfterFor_no_ext +end AfterFor_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/package.order b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/package.order new file mode 100644 index 0000000..9b27688 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterFor_no_ext/package.order @@ -0,0 +1,2 @@ +AfterFor_no_ext_wip +AfterFor_no_ext2 diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil.mo new file mode 100644 index 0000000..0d4583b --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil.mo @@ -0,0 +1,69 @@ +within CRML_test.FORML.AfterUntil; +block AfterUntil +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation( + Placement(transformation(extent = {{-120, 30}, {-100, 50}}), iconTransformation(extent = {{-120, 30}, {-100, 50}}))); + CRML.ETL.Connectors.WhileInput tl annotation( + Placement(transformation(extent = {{-10, 90}, {10, 110}}), iconTransformation(extent = {{-10, 90}, {10, 110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_until_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation( + Placement(transformation(extent = {{-120, -50}, {-100, -30}}), iconTransformation(extent={{-120, + -50},{-100,-30}}))); + CRML.ETL.TimeLocators.Periods periods(leftBoundaryIncluded = false, + rightBoundaryIncluded=true) annotation( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 annotation( + Placement(transformation(extent = {{-80, 30}, {-60, 50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 annotation( + Placement(transformation(extent = {{-44, 36}, {-36, 44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 annotation( + Placement(transformation(extent = {{-80, -50}, {-60, -30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 annotation( + Placement(transformation(extent = {{-44, -44}, {-36, -36}}))); + +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + connect(ck1, clockToBoolean_ck1.u) annotation( + Line(points = {{-110, 40}, {-82, 40}}, color = {175, 175, 175}, pattern = LinePattern.Dot, thickness = 0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) annotation( + Line(points = {{-59, 40}, {-44.4, 40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck1.y, periods.u1) annotation( + Line(points = {{-35.6, 40}, {-20, 40}, {-20, 0}, {-11, 0}}, color = {162, 29, 33})); + connect(ck2, clockToBoolean_ck2.u) annotation( + Line(points = {{-110, -40}, {-82, -40}}, color = {175, 175, 175}, pattern = LinePattern.Dot, thickness = 0.5)); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) annotation( + Line(points = {{-59, -40}, {-44.4, -40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck2.y, periods.u2) annotation( + Line(points = {{-35.6, -40}, {-20, -40}, {-20, -8}, {-11, -8}}, color = {162, 29, 33})); + connect(periods.y, p_after_b1_until_b2) annotation (Line(points={{0,-10},{0,-20}, + {80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, periods.tl) annotation( + Line(points = {{0, 100}, {0, 10}}, color = {0, 0, 255})); + annotation( + Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Rectangle(fillColor = {85, 170, 255}, fillPattern = FillPattern.Solid, lineThickness = 5, borderPattern = BorderPattern.Raised, extent = {{-100, 100}, {100, -100}}), Rectangle(lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-70, 30}, {70, -52}}), Line(points = {{-50, -34}, {-50, -12}}, pattern = LinePattern.Dash), Line(points = {{-48, -12}, {52, -12}}, pattern = LinePattern.Dash), Line(points = {{52, -12}, {52, -34}}, pattern = LinePattern.Dash), Line(points = {{-62, -34}, {58, -34}}, color = {175, 175, 175}), Line(points = {{-50, -12}, {-50, 10}}, pattern = LinePattern.Dash), Rectangle(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, extent = {{22, 2}, {52, -12}}), Line(points = {{-50, 10}, {22, 10}}, pattern = LinePattern.Dash), Line(points = {{22, 10}, {22, -12}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {20, -10}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {24, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-52, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-48, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, 30}, {-70, 30}, {-70, -52}, {-50, -52}}), Line(points = {{50, 30}, {70, 30}, {70, -52}, {50, -52}}), Text(textColor = {175, 175, 175}, extent = {{-28, -10}, {22, -34}}, textString = "%u"), Text(extent = {{-78, 86}, {76, 38}}, + textString="after until", + textColor={0,0,0})}), + Diagram(coordinateSystem(preserveAspectRatio = false)), + Documentation(info = " +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end AfterUntil; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_externals.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_externals.mo new file mode 100644 index 0000000..8bb6f74 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_externals.mo @@ -0,0 +1,43 @@ +within CRML_test.FORML.AfterUntil; +model AfterUntil_externals + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-60,50},{-40,70}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); + CRML.ETL.Connectors.ClockOutput ck1 + annotation (Placement(transformation(extent={{100,40},{120,60}}))); + CRML.ETL.Connectors.ClockOutput ck2 + annotation (Placement(transformation(extent={{100,-80},{120,-60}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-6,54},{6,66}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-6,-66},{6,-54}}))); +equation + connect(b1.y, clockEvent_1.u) + annotation (Line(points={{-39,60},{-6.6,60}}, color={217,67,180})); + connect(clockEvent_1.y, ck1) annotation (Line( + points={{6.6,60},{40,60},{40,50},{110,50}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(b2.y, clockEvent_2.u) + annotation (Line(points={{-39,-60},{-6.6,-60}}, color={217,67,180})); + connect(clockEvent_2.y, ck2) annotation (Line( + points={{6.6,-60},{40,-60},{40,-70},{110,-70}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end AfterUntil_externals; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_verif.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_verif.mo new file mode 100644 index 0000000..d2e5fee --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_verif.mo @@ -0,0 +1,24 @@ +within CRML_test.FORML.AfterUntil; +model AfterUntil_verif + AfterUntil_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + AfterUntil afterUntil + annotation (Placement(transformation(extent={{0,0},{20,20}}))); +equation + // Bindings + externals.ck1 =afterUntil.ck1; + externals.ck2 =afterUntil.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,60},{64,0},{-36,-60},{-36,60}})}), experiment( + StopTime=20, + __Dymola_fixedstepsize=0.1, + __Dymola_Algorithm="Dassl")); +end AfterUntil_verif; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_verif2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_verif2.mo new file mode 100644 index 0000000..cd9ca8a --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntil_verif2.mo @@ -0,0 +1,22 @@ +within CRML_test.FORML.AfterUntil; +model AfterUntil_verif2 + + AfterUntil_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + AfterUntill2 afterUntil2 + annotation (Placement(transformation(extent={{-26,16},{-6,36}}))); +equation + // Bindings + externals.ck1 =afterUntil2.ck1; + externals.ck2 =afterUntil2.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-102},{100,98}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,58},{64,-2},{-36,-62},{-36,58}})})); +end AfterUntil_verif2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntill2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntill2.mo new file mode 100644 index 0000000..0ff44ef --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/AfterUntill2.mo @@ -0,0 +1,96 @@ +within CRML_test.FORML.AfterUntil; +block AfterUntill2 + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; + +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,30},{-100,50}}), iconTransformation(extent={{-120,30}, + {-100,50}}))); + CRML.ETL.Connectors.WhileInput tl annotation (Placement( + transformation(extent={{-10,90},{10,110}}), iconTransformation(extent={ + {-10,90},{10,110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_until_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,-50},{-100,-30}}), iconTransformation( + extent={{-120,-50},{-100,-30}}))); + CRML.TimeLocators.Continuous.AfterUntil + afterUntil + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 + annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 + annotation (Placement(transformation(extent={{-44,36},{-36,44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 + annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 + annotation (Placement(transformation(extent={{-44,-44},{-36,-36}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + + connect(ck1, clockToBoolean_ck1.u) annotation (Line( + points={{-110,40},{-110,40},{-110,40},{-82,40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) + annotation (Line(points={{-59,40},{-44.4,40}}, color={255,0,255})); + connect(booleanToBoolean4_ck1.y, afterUntil.u1) annotation (Line(points={{-35.6, + 40},{-20,40},{-20,0},{-11,0}}, color={162,29,33})); + connect(ck2, clockToBoolean_ck2.u) annotation (Line( + points={{-110,-40},{-82,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) + annotation (Line(points={{-59,-40},{-44.4,-40}}, color={255,0,255})); + connect(booleanToBoolean4_ck2.y, afterUntil.u2) annotation (Line(points={{-35.6, + -40},{-20,-40},{-20,-8},{-11,-8}}, color={162,29,33})); + connect(afterUntil.y, p_after_b1_until_b2) annotation (Line(points={{0,-10},{ + 0,-20},{80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, afterUntil.tl) + annotation (Line(points={{0,100},{0,10}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle(extent={{-100, + 100},{100,-100}}, fillColor = {85, 170, 255}, lineThickness = 5, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised, lineColor = {0, 0, 0}), Rectangle(extent={{-70,30}, + {70,-52}}, lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points={{-50,-34}, + {-50,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-48,-12}, + {52,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{52,-12}, + {52,-34}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-62,-34}, + {58,-34}}, color = {175, 175, 175}), Line(points={{-50,-12}, + {-50,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Rectangle(extent={{22,2},{ + 52,-12}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Line(points={{-50,10}, + {22,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,10}, + {22,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {20,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {24,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-52,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-48,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,30}, + {-70,30},{-70,-52},{-50,-52}}, color = {0, 0, 0}), Line(points={{50,30}, + {70,30},{70,-52},{50,-52}}, color = {0, 0, 0}), Text(extent={{-28,-10}, + {22,-34}}, lineColor = {175, 175, 175}, pattern = LinePattern.Dash, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "%u"), Text(extent={{-78,86}, + {76,38}}, lineColor={0,0,0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, + textString="after until")}), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end AfterUntill2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/package.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/package.mo new file mode 100644 index 0000000..0aa04c3 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package AfterUntil +end AfterUntil; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil/package.order b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/package.order new file mode 100644 index 0000000..7b71aaf --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil/package.order @@ -0,0 +1,5 @@ +AfterUntil +AfterUntill2 +AfterUntil_externals +AfterUntil_verif +AfterUntil_verif2 diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/AfterUntil_no_ext.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/AfterUntil_no_ext.mo new file mode 100644 index 0000000..aedbc21 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/AfterUntil_no_ext.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.AfterUntil_no_ext; +model AfterUntil_no_ext +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + AfterUntil.AfterUntil afterUntil + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_until_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_2.y, afterUntil.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_1.y, afterUntil.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(afterUntil.p_after_b1_until_b2, p_after_b1_until_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end AfterUntil_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/AfterUntil_no_ext2.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/AfterUntil_no_ext2.mo new file mode 100644 index 0000000..2c05e42 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/AfterUntil_no_ext2.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.AfterUntil_no_ext; +model AfterUntil_no_ext2 +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + AfterUntil.AfterUntill2 afterUntill2_1 + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_after_b1_until_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_1.y, afterUntill2_1.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_2.y, afterUntill2_1.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(afterUntill2_1.p_after_b1_until_b2, p_after_b1_until_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end AfterUntil_no_ext2; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/package.mo b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/package.mo new file mode 100644 index 0000000..451b69e --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package AfterUntil_no_ext +end AfterUntil_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/package.order b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/package.order new file mode 100644 index 0000000..226f9d7 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/AfterUntil_no_ext/package.order @@ -0,0 +1,2 @@ +AfterUntil_no_ext +AfterUntil_no_ext2 diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore.mo new file mode 100644 index 0000000..94fdb21 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore.mo @@ -0,0 +1,71 @@ +within CRML_test.FORML.FromBefore; +block FromBefore +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation( + Placement(transformation(extent = {{-120, 30}, {-100, 50}}), iconTransformation(extent = {{-120, 30}, {-100, 50}}))); + CRML.ETL.Connectors.WhileInput tl annotation( + Placement(transformation(extent = {{-10, 90}, {10, 110}}), iconTransformation(extent = {{-10, 90}, {10, 110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_before_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); + CRML.ETL.TimeLocators.Periods periods(leftBoundaryIncluded=true, rightBoundaryIncluded = false) annotation( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 annotation( + Placement(transformation(extent = {{-80, 30}, {-60, 50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 annotation( + Placement(transformation(extent = {{-44, 36}, {-36, 44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 annotation( + Placement(transformation(extent = {{-80, -50}, {-60, -30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 annotation( + Placement(transformation(extent = {{-44, -44}, {-36, -36}}))); + +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation( + Placement(transformation(extent={{-120,-50},{-100,-30}}), iconTransformation(extent={{-120, + -50},{-100,-30}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + connect(ck1, clockToBoolean_ck1.u) annotation( + Line(points = {{-110, 40}, {-82, 40}}, color = {175, 175, 175}, pattern = LinePattern.Dot, thickness = 0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) annotation( + Line(points = {{-59, 40}, {-44.4, 40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck1.y, periods.u1) annotation( + Line(points = {{-35.6, 40}, {-20, 40}, {-20, 0}, {-11, 0}}, color = {162, 29, 33})); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) annotation( + Line(points = {{-59, -40}, {-44.4, -40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck2.y, periods.u2) annotation( + Line(points = {{-35.6, -40}, {-20, -40}, {-20, -8}, {-11, -8}}, color = {162, 29, 33})); + connect(periods.y, p_from_b1_before_b2) annotation (Line(points={{0,-10},{0,-20}, + {80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, periods.tl) annotation( + Line(points = {{0, 100}, {0, 10}}, color = {0, 0, 255})); + connect(clockToBoolean_ck2.u, ck2) annotation (Line( + points={{-82,-40},{-110,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation( + Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Rectangle(fillColor = {85, 170, 255}, fillPattern = FillPattern.Solid, lineThickness = 5, borderPattern = BorderPattern.Raised, extent = {{-100, 100}, {100, -100}}), Rectangle(lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-70, 30}, {70, -52}}), Line(points = {{-50, -34}, {-50, -12}}, pattern = LinePattern.Dash), Line(points = {{-48, -12}, {52, -12}}, pattern = LinePattern.Dash), Line(points = {{52, -12}, {52, -34}}, pattern = LinePattern.Dash), Line(points = {{-62, -34}, {58, -34}}, color = {175, 175, 175}), Line(points = {{-50, -12}, {-50, 10}}, pattern = LinePattern.Dash), Rectangle(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, extent = {{22, 2}, {52, -12}}), Line(points = {{-50, 10}, {22, 10}}, pattern = LinePattern.Dash), Line(points = {{22, 10}, {22, -12}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {20, -10}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {24, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-52, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-48, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, 30}, {-70, 30}, {-70, -52}, {-50, -52}}), Line(points = {{50, 30}, {70, 30}, {70, -52}, {50, -52}}), Text(textColor = {175, 175, 175}, extent = {{-28, -10}, {22, -34}}, textString = "%u"), Text(extent = {{-78, 86}, {76, 38}}, + textString="from before", + textColor={0,0,0})}), + Diagram(coordinateSystem(preserveAspectRatio = false)), + Documentation(info = " +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end FromBefore; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore2.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore2.mo new file mode 100644 index 0000000..787cb2e --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore2.mo @@ -0,0 +1,96 @@ +within CRML_test.FORML.FromBefore; +block FromBefore2 + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; + +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,30},{-100,50}}), iconTransformation(extent={{-120,30}, + {-100,50}}))); + CRML.ETL.Connectors.WhileInput tl annotation (Placement( + transformation(extent={{-10,90},{10,110}}), iconTransformation(extent={ + {-10,90},{10,110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_before_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,-50},{-100,-30}}), iconTransformation( + extent={{-120,-50},{-100,-30}}))); + CRML.TimeLocators.Continuous.FromBefore + fromBefore + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 + annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 + annotation (Placement(transformation(extent={{-44,36},{-36,44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 + annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 + annotation (Placement(transformation(extent={{-44,-44},{-36,-36}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + + connect(ck1, clockToBoolean_ck1.u) annotation (Line( + points={{-110,40},{-110,40},{-110,40},{-82,40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) + annotation (Line(points={{-59,40},{-44.4,40}}, color={255,0,255})); + connect(booleanToBoolean4_ck1.y, fromBefore.u1) annotation (Line(points={{-35.6, + 40},{-20,40},{-20,0},{-11,0}}, color={162,29,33})); + connect(ck2, clockToBoolean_ck2.u) annotation (Line( + points={{-110,-40},{-82,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) + annotation (Line(points={{-59,-40},{-44.4,-40}}, color={255,0,255})); + connect(booleanToBoolean4_ck2.y, fromBefore.u2) annotation (Line(points={{-35.6, + -40},{-20,-40},{-20,-8},{-11,-8}}, color={162,29,33})); + connect(fromBefore.y, p_from_b1_before_b2) annotation (Line(points={{0,-10},{ + 0,-20},{80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, fromBefore.tl) + annotation (Line(points={{0,100},{0,10}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle(extent={{-100, + 100},{100,-100}}, fillColor = {85, 170, 255}, lineThickness = 5, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised, lineColor = {0, 0, 0}), Rectangle(extent={{-70,30}, + {70,-52}}, lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points={{-50,-34}, + {-50,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-48,-12}, + {52,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{52,-12}, + {52,-34}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-62,-34}, + {58,-34}}, color = {175, 175, 175}), Line(points={{-50,-12}, + {-50,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Rectangle(extent={{22,2},{ + 52,-12}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Line(points={{-50,10}, + {22,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,10}, + {22,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {20,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {24,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-52,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-48,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,30}, + {-70,30},{-70,-52},{-50,-52}}, color = {0, 0, 0}), Line(points={{50,30}, + {70,30},{70,-52},{50,-52}}, color = {0, 0, 0}), Text(extent={{-28,-10}, + {22,-34}}, lineColor = {175, 175, 175}, pattern = LinePattern.Dash, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "%u"), Text(extent={{-78,86}, + {76,38}}, lineColor={0,0,0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, + textString="from before")}), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end FromBefore2; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_externals.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_externals.mo new file mode 100644 index 0000000..3a4902e --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_externals.mo @@ -0,0 +1,43 @@ +within CRML_test.FORML.FromBefore; +model FromBefore_externals + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-60,50},{-40,70}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); + CRML.ETL.Connectors.ClockOutput ck1 + annotation (Placement(transformation(extent={{100,40},{120,60}}))); + CRML.ETL.Connectors.ClockOutput ck2 + annotation (Placement(transformation(extent={{100,-80},{120,-60}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-6,54},{6,66}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-6,-66},{6,-54}}))); +equation + connect(b1.y, clockEvent_1.u) + annotation (Line(points={{-39,60},{-6.6,60}}, color={217,67,180})); + connect(clockEvent_1.y, ck1) annotation (Line( + points={{6.6,60},{40,60},{40,50},{110,50}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(b2.y, clockEvent_2.u) + annotation (Line(points={{-39,-60},{-6.6,-60}}, color={217,67,180})); + connect(clockEvent_2.y, ck2) annotation (Line( + points={{6.6,-60},{40,-60},{40,-70},{110,-70}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end FromBefore_externals; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_verif.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_verif.mo new file mode 100644 index 0000000..8ff6182 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_verif.mo @@ -0,0 +1,21 @@ +within CRML_test.FORML.FromBefore; +model FromBefore_verif + FromBefore_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + FromBefore fromBefore + annotation (Placement(transformation(extent={{0,0},{20,20}}))); +equation + // Bindings + externals.ck1 =fromBefore.ck1; + externals.ck2 =fromBefore.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,60},{64,0},{-36,-60},{-36,60}})})); +end FromBefore_verif; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_verif2.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_verif2.mo new file mode 100644 index 0000000..767ad1a --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/FromBefore_verif2.mo @@ -0,0 +1,22 @@ +within CRML_test.FORML.FromBefore; +model FromBefore_verif2 + + FromBefore_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + FromBefore2 fromBefore2 + annotation (Placement(transformation(extent={{-26,16},{-6,36}}))); +equation + // Bindings + externals.ck1 =fromBefore2.ck1; + externals.ck2 =fromBefore2.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-102},{100,98}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,58},{64,-2},{-36,-62},{-36,58}})})); +end FromBefore_verif2; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/package.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore/package.mo new file mode 100644 index 0000000..cf974fe --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package FromBefore +end FromBefore; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore/package.order b/resources/modelica_libraries/CRML_test/FORML/FromBefore/package.order new file mode 100644 index 0000000..472beef --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore/package.order @@ -0,0 +1,5 @@ +FromBefore +FromBefore2 +FromBefore_externals +FromBefore_verif +FromBefore_verif2 diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/FromBefore_no_ext.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/FromBefore_no_ext.mo new file mode 100644 index 0000000..3bd6028 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/FromBefore_no_ext.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.FromBefore_no_ext; +model FromBefore_no_ext +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + FromBefore.FromBefore fromBefore + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_before_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_2.y, fromBefore.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_1.y, fromBefore.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(fromBefore.p_from_b1_before_b2, p_from_b1_before_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end FromBefore_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/FromBefore_no_ext2.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/FromBefore_no_ext2.mo new file mode 100644 index 0000000..e32a55c --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/FromBefore_no_ext2.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.FromBefore_no_ext; +model FromBefore_no_ext2 +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + FromBefore.FromBefore2 fromBefore2_1 + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_before_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_1.y, fromBefore2_1.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_2.y, fromBefore2_1.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(fromBefore2_1.p_from_b1_before_b2, p_from_b1_before_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end FromBefore_no_ext2; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/package.mo b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/package.mo new file mode 100644 index 0000000..51fbeb9 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package FromBefore_no_ext +end FromBefore_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/package.order b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/package.order new file mode 100644 index 0000000..389ba5c --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromBefore_no_ext/package.order @@ -0,0 +1,2 @@ +FromBefore_no_ext +FromBefore_no_ext2 diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil.mo new file mode 100644 index 0000000..61a89b5 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil.mo @@ -0,0 +1,72 @@ +within CRML_test.FORML.FromUntil; +block FromUntil +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation( + Placement(transformation(extent = {{-120, 30}, {-100, 50}}), iconTransformation(extent = {{-120, 30}, {-100, 50}}))); + CRML.ETL.Connectors.WhileInput tl annotation( + Placement(transformation(extent = {{-10, 90}, {10, 110}}), iconTransformation(extent = {{-10, 90}, {10, 110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_until_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); + CRML.ETL.TimeLocators.Periods periods(leftBoundaryIncluded=true, + rightBoundaryIncluded=true) annotation( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 annotation( + Placement(transformation(extent = {{-80, 30}, {-60, 50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 annotation( + Placement(transformation(extent = {{-44, 36}, {-36, 44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 annotation( + Placement(transformation(extent = {{-80, -50}, {-60, -30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 annotation( + Placement(transformation(extent = {{-44, -44}, {-36, -36}}))); + +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation( + Placement(transformation(extent={{-120,-50},{-100,-30}}), iconTransformation(extent={{-120, + -50},{-100,-30}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + connect(ck1, clockToBoolean_ck1.u) annotation( + Line(points = {{-110, 40}, {-82, 40}}, color = {175, 175, 175}, pattern = LinePattern.Dot, thickness = 0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) annotation( + Line(points = {{-59, 40}, {-44.4, 40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck1.y, periods.u1) annotation( + Line(points = {{-35.6, 40}, {-20, 40}, {-20, 0}, {-11, 0}}, color = {162, 29, 33})); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) annotation( + Line(points = {{-59, -40}, {-44.4, -40}}, color = {255, 0, 255})); + connect(booleanToBoolean4_ck2.y, periods.u2) annotation( + Line(points = {{-35.6, -40}, {-20, -40}, {-20, -8}, {-11, -8}}, color = {162, 29, 33})); + connect(periods.y, p_from_b1_until_b2) annotation (Line(points={{0,-10},{0,-20}, + {80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, periods.tl) annotation( + Line(points = {{0, 100}, {0, 10}}, color = {0, 0, 255})); + connect(clockToBoolean_ck2.u, ck2) annotation (Line( + points={{-82,-40},{-110,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation( + Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Rectangle(fillColor = {85, 170, 255}, fillPattern = FillPattern.Solid, lineThickness = 5, borderPattern = BorderPattern.Raised, extent = {{-100, 100}, {100, -100}}), Rectangle(lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-70, 30}, {70, -52}}), Line(points = {{-50, -34}, {-50, -12}}, pattern = LinePattern.Dash), Line(points = {{-48, -12}, {52, -12}}, pattern = LinePattern.Dash), Line(points = {{52, -12}, {52, -34}}, pattern = LinePattern.Dash), Line(points = {{-62, -34}, {58, -34}}, color = {175, 175, 175}), Line(points = {{-50, -12}, {-50, 10}}, pattern = LinePattern.Dash), Rectangle(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, extent = {{22, 2}, {52, -12}}), Line(points = {{-50, 10}, {22, 10}}, pattern = LinePattern.Dash), Line(points = {{22, 10}, {22, -12}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {20, -10}}, pattern = LinePattern.Dash), Line(points = {{22, -12}, {24, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-52, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, -12}, {-48, -10}}, pattern = LinePattern.Dash), Line(points = {{-50, 30}, {-70, 30}, {-70, -52}, {-50, -52}}), Line(points = {{50, 30}, {70, 30}, {70, -52}, {50, -52}}), Text(textColor = {175, 175, 175}, extent = {{-28, -10}, {22, -34}}, textString = "%u"), Text(extent = {{-78, 86}, {76, 38}}, + textColor={0,0,0}, + textString="from until")}), + Diagram(coordinateSystem(preserveAspectRatio = false)), + Documentation(info = " +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end FromUntil; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil2.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil2.mo new file mode 100644 index 0000000..77a74f3 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil2.mo @@ -0,0 +1,96 @@ +within CRML_test.FORML.FromUntil; +block FromUntil2 + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + CRML.ETL.Connectors.WhileOutput tl1 = tl; + +public + CRML.ETL.Connectors.ClockInput ck1 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,30},{-100,50}}), iconTransformation(extent={{-120,30}, + {-100,50}}))); + CRML.ETL.Connectors.WhileInput tl annotation (Placement( + transformation(extent={{-10,90},{10,110}}), iconTransformation(extent={ + {-10,90},{10,110}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_until_b2 + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); +public + CRML.ETL.Connectors.ClockInput ck2 "Boolean4 condition" annotation (Placement( + transformation(extent={{-120,-50},{-100,-30}}), iconTransformation( + extent={{-120,-50},{-100,-30}}))); + CRML.TimeLocators.Continuous.FromUntil + fromUntil + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck1 + annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck1 + annotation (Placement(transformation(extent={{-44,36},{-36,44}}))); + Modelica.Clocked.BooleanSignals.NonPeriodic.ClockToBoolean clockToBoolean_ck2 + annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}))); + CRML.Blocks.Logical4.BooleanToBoolean4 booleanToBoolean4_ck2 + annotation (Placement(transformation(extent={{-44,-44},{-36,-36}}))); +equation + if (cardinality(tl) == 0) then + tl.timePeriod = true; + tl.clock = CRML.ETL.Types.Boolean4.true4; + tl.isLeftBoundaryIncluded = true; + tl.isRightBoundaryIncluded = true; + end if; + + connect(ck1, clockToBoolean_ck1.u) annotation (Line( + points={{-110,40},{-110,40},{-110,40},{-82,40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck1.y, booleanToBoolean4_ck1.u) + annotation (Line(points={{-59,40},{-44.4,40}}, color={255,0,255})); + connect(booleanToBoolean4_ck1.y, fromUntil.u1) annotation (Line(points={{-35.6, + 40},{-20,40},{-20,0},{-11,0}}, color={162,29,33})); + connect(ck2, clockToBoolean_ck2.u) annotation (Line( + points={{-110,-40},{-82,-40}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockToBoolean_ck2.y, booleanToBoolean4_ck2.u) + annotation (Line(points={{-59,-40},{-44.4,-40}}, color={255,0,255})); + connect(booleanToBoolean4_ck2.y, fromUntil.u2) annotation (Line(points={{-35.6, + -40},{-20,-40},{-20,-8},{-11,-8}}, color={162,29,33})); + connect(fromUntil.y, p_from_b1_until_b2) annotation (Line(points={{0,-10},{0, + -20},{80,-20},{80,0},{110,0}}, color={0,0,255})); + connect(tl1, fromUntil.tl) + annotation (Line(points={{0,100},{0,10}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle(extent={{-100, + 100},{100,-100}}, fillColor = {85, 170, 255}, lineThickness = 5, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised, lineColor = {0, 0, 0}), Rectangle(extent={{-70,30}, + {70,-52}}, lineColor = {175, 175, 175}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points={{-50,-34}, + {-50,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-48,-12}, + {52,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{52,-12}, + {52,-34}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-62,-34}, + {58,-34}}, color = {175, 175, 175}), Line(points={{-50,-12}, + {-50,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Rectangle(extent={{22,2},{ + 52,-12}}, lineColor = {0, 0, 0}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Line(points={{-50,10}, + {22,10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,10}, + {22,-12}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {20,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{22,-12}, + {24,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-52,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,-12}, + {-48,-10}}, color = {0, 0, 0}, pattern = LinePattern.Dash), Line(points={{-50,30}, + {-70,30},{-70,-52},{-50,-52}}, color = {0, 0, 0}), Line(points={{50,30}, + {70,30},{70,-52},{50,-52}}, color = {0, 0, 0}), Text(extent={{-28,-10}, + {22,-34}}, lineColor = {175, 175, 175}, pattern = LinePattern.Dash, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, textString = "%u"), Text(extent={{-78,86}, + {76,38}}, lineColor={0,0,0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, + textString="from until")}), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

Syntax

+
y = CheckAtEnd (u = condition, tl = time_period, checkAtEnd);
+

Description

+

Each instance of this block creates a requirement that evaluates whether the condition u is satisfied (true) at the end of the time period tl (which can be a continuous or discrete time period). The condition is a Boolean4 that takes its values in the { true, false, undecided, undefined } set.

+

To create time locators, refer to the Periods block.

+

The value of a requirement is a Boolean4 that can be used as input of another Ensure block. It is therefore possible to express requirements on requirements.

+

Requirements can be combined using Boolean4 operators, refer to the Logical4 package.

+

The condition u can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4, or by using the output y of another Check, CheckInteger or CheckReal block.

+


Example

+

This block is demonstrated with the following example:

+")); +end FromUntil2; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_externals.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_externals.mo new file mode 100644 index 0000000..7b84c2c --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_externals.mo @@ -0,0 +1,43 @@ +within CRML_test.FORML.FromUntil; +model FromUntil_externals + +protected + parameter Integer N=CRML.ETL.Types.nMaxOverlap; + +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-60,50},{-40,70}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); + CRML.ETL.Connectors.ClockOutput ck1 + annotation (Placement(transformation(extent={{100,40},{120,60}}))); + CRML.ETL.Connectors.ClockOutput ck2 + annotation (Placement(transformation(extent={{100,-80},{120,-60}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-6,54},{6,66}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-6,-66},{6,-54}}))); +equation + connect(b1.y, clockEvent_1.u) + annotation (Line(points={{-39,60},{-6.6,60}}, color={217,67,180})); + connect(clockEvent_1.y, ck1) annotation (Line( + points={{6.6,60},{40,60},{40,50},{110,50}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(b2.y, clockEvent_2.u) + annotation (Line(points={{-39,-60},{-6.6,-60}}, color={217,67,180})); + connect(clockEvent_2.y, ck2) annotation (Line( + points={{6.6,-60},{40,-60},{40,-70},{110,-70}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end FromUntil_externals; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_verif.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_verif.mo new file mode 100644 index 0000000..c87b165 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_verif.mo @@ -0,0 +1,21 @@ +within CRML_test.FORML.FromUntil; +model FromUntil_verif + FromUntil_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + FromUntil fromUntil + annotation (Placement(transformation(extent={{0,0},{20,20}}))); +equation + // Bindings + externals.ck1 =fromUntil.ck1; + externals.ck2 =fromUntil.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,60},{64,0},{-36,-60},{-36,60}})})); +end FromUntil_verif; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_verif2.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_verif2.mo new file mode 100644 index 0000000..8e3a476 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/FromUntil_verif2.mo @@ -0,0 +1,22 @@ +within CRML_test.FORML.FromUntil; +model FromUntil_verif2 + + FromUntil_externals externals + annotation (Placement(transformation(extent={{-200,0},{-140,60}}))); + FromUntil2 fromUntil2 + annotation (Placement(transformation(extent={{-26,16},{-6,36}}))); +equation + // Bindings + externals.ck1 =fromUntil2.ck1; + externals.ck2 =fromUntil2.ck2; + annotation (Icon(graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent={{-100,-102},{100,98}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points={{-36,58},{64,-2},{-36,-62},{-36,58}})})); +end FromUntil_verif2; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/package.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil/package.mo new file mode 100644 index 0000000..740fa4a --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package FromUntil +end FromUntil; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil/package.order b/resources/modelica_libraries/CRML_test/FORML/FromUntil/package.order new file mode 100644 index 0000000..47ec878 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil/package.order @@ -0,0 +1,5 @@ +FromUntil +FromUntil2 +FromUntil_externals +FromUntil_verif +FromUntil_verif2 diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/FromUntil_no_ext.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/FromUntil_no_ext.mo new file mode 100644 index 0000000..4458ed9 --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/FromUntil_no_ext.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.FromUntil_no_ext; +model FromUntil_no_ext +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + FromUntil.FromUntil fromUntil + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_until_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_2.y, fromUntil.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_1.y, fromUntil.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(fromUntil.p_from_b1_until_b2, p_from_b1_until_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end FromUntil_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/FromUntil_no_ext2.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/FromUntil_no_ext2.mo new file mode 100644 index 0000000..46d561a --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/FromUntil_no_ext2.mo @@ -0,0 +1,42 @@ +within CRML_test.FORML.FromUntil_no_ext; +model FromUntil_no_ext2 +protected + parameter Integer N = CRML.ETL.Types.nMaxOverlap; +public + CRML.Blocks.Logical.BooleanTable b1( + y0=false, + option_width=false, + instant={2,3.5,4,5,5.5,5.6,8,8.1,16}) + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + CRML.Blocks.Logical.BooleanTable b2( + y0=false, + option_width=false, + instant={2.5,5,6,7,7.5,10}) + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + CRML.Blocks.Events.ClockEvent clockEvent_1 + annotation (Placement(transformation(extent={{-26,24},{-14,36}}))); + CRML.Blocks.Events.ClockEvent clockEvent_2 + annotation (Placement(transformation(extent={{-26,-56},{-14,-44}}))); + FromUntil.FromUntil2 fromUntil2_1 + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + CRML.ETL.Connectors.TimeLocatorOutput[N] p_from_b1_until_b2 + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); +equation + + connect(b1.y,clockEvent_1. u) + annotation (Line(points={{-59,30},{-26.6,30}},color={217,67,180})); + connect(b2.y,clockEvent_2. u) + annotation (Line(points={{-59,-50},{-26.6,-50}},color={217,67,180})); + connect(clockEvent_1.y, fromUntil2_1.ck1) annotation (Line( + points={{-13.4,30},{34,30},{34,4},{39,4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(clockEvent_2.y, fromUntil2_1.ck2) annotation (Line( + points={{-13.4,-50},{34,-50},{34,-4},{39,-4}}, + color={175,175,175}, + pattern=LinePattern.Dot, + thickness=0.5)); + connect(fromUntil2_1.p_from_b1_until_b2, p_from_b1_until_b2) + annotation (Line(points={{61,0},{102,0}}, color={0,0,255})); +end FromUntil_no_ext2; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/package.mo b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/package.mo new file mode 100644 index 0000000..119b79f --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/package.mo @@ -0,0 +1,3 @@ +within CRML_test.FORML; +package FromUntil_no_ext +end FromUntil_no_ext; diff --git a/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/package.order b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/package.order new file mode 100644 index 0000000..75a39ea --- /dev/null +++ b/resources/modelica_libraries/CRML_test/FORML/FromUntil_no_ext/package.order @@ -0,0 +1,2 @@ +FromUntil_no_ext +FromUntil_no_ext2 diff --git a/resources/modelica_libraries/CRML_test/FORML/package.mo b/resources/modelica_libraries/CRML_test/FORML/package.mo index 844991d..d59120e 100644 --- a/resources/modelica_libraries/CRML_test/FORML/package.mo +++ b/resources/modelica_libraries/CRML_test/FORML/package.mo @@ -1,4 +1,4 @@ -within CRML_test; +within CRML_test; package FORML annotation (Icon(graphics={ Rectangle( diff --git a/resources/modelica_libraries/CRML_test/FORML/package.order b/resources/modelica_libraries/CRML_test/FORML/package.order index 5f8fba0..ed2f762 100644 --- a/resources/modelica_libraries/CRML_test/FORML/package.order +++ b/resources/modelica_libraries/CRML_test/FORML/package.order @@ -1 +1,11 @@ CheckAtEnd +AfterBefore +AfterBefore_no_ext +AfterFor +AfterFor_no_ext +AfterUntil +AfterUntil_no_ext +FromBefore +FromBefore_no_ext +FromUntil +FromUntil_no_ext diff --git a/src/test/resources/refResults/libraries/FORML_test/AfterBefore_no_ext_ref.mat b/src/test/resources/refResults/libraries/FORML_test/AfterBefore_no_ext_ref.mat new file mode 100644 index 0000000..a79d6fe Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/AfterBefore_no_ext_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/AfterBefore_verif_ref.mat b/src/test/resources/refResults/libraries/FORML_test/AfterBefore_verif_ref.mat new file mode 100644 index 0000000..7ee27de Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/AfterBefore_verif_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/AfterUntil_no_ext_ref.mat b/src/test/resources/refResults/libraries/FORML_test/AfterUntil_no_ext_ref.mat new file mode 100644 index 0000000..befe2f1 Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/AfterUntil_no_ext_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/AfterUntil_verif_ref.mat b/src/test/resources/refResults/libraries/FORML_test/AfterUntil_verif_ref.mat new file mode 100644 index 0000000..d8a94a6 Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/AfterUntil_verif_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/FromBefore_no_ext_ref.mat b/src/test/resources/refResults/libraries/FORML_test/FromBefore_no_ext_ref.mat new file mode 100644 index 0000000..d637e40 Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/FromBefore_no_ext_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/FromBefore_verif_ref.mat b/src/test/resources/refResults/libraries/FORML_test/FromBefore_verif_ref.mat new file mode 100644 index 0000000..4339e1d Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/FromBefore_verif_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/FromUntil_no_ext_ref.mat b/src/test/resources/refResults/libraries/FORML_test/FromUntil_no_ext_ref.mat new file mode 100644 index 0000000..9d71afa Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/FromUntil_no_ext_ref.mat differ diff --git a/src/test/resources/refResults/libraries/FORML_test/FromUntil_verif_ref.mat b/src/test/resources/refResults/libraries/FORML_test/FromUntil_verif_ref.mat new file mode 100644 index 0000000..a2e5ce2 Binary files /dev/null and b/src/test/resources/refResults/libraries/FORML_test/FromUntil_verif_ref.mat differ diff --git a/src/test/resources/testModels/libraries/FORML_test/AfterBefore_no_ext.crml b/src/test/resources/testModels/libraries/FORML_test/AfterBefore_no_ext.crml index 4a8314f..6fdd46d 100644 --- a/src/test/resources/testModels/libraries/FORML_test/AfterBefore_no_ext.crml +++ b/src/test/resources/testModels/libraries/FORML_test/AfterBefore_no_ext.crml @@ -1,9 +1,20 @@ -model AfterBefore is { +model AfterBefore_no_ext is { // After events occur and before events occur Operator [ Periods ] 'after' Clock ev1 'before' Clock ev2 = new Periods ] ev1, ev2 [; // Example of function call - Boolean b1 is if 2.0 < time and time < 3.5 then true else false; - Boolean b2 is if 2.5 < time and time < 5 then true else false; + Boolean b1 is + if (2.0 < time and time < 3.5) + or (4.0 < time and time < 5.0) + or (5.5 < time and time < 5.6) + or (16.0 < time) + then true + else false; + Boolean b2 is + if (2.5 < time and time < 5) + or (6.0 < time and time < 7.0) + or (7.5 < time and time < 10.0) + then true + else false; Periods p_after_b1_before_b2 is 'after' new Clock b1 'before' new Clock b2; }; \ No newline at end of file diff --git a/src/test/resources/testModels/libraries/FORML_test/AfterUntil.crml b/src/test/resources/testModels/libraries/FORML_test/AfterUntil.crml new file mode 100644 index 0000000..187ba7e --- /dev/null +++ b/src/test/resources/testModels/libraries/FORML_test/AfterUntil.crml @@ -0,0 +1,9 @@ +model AfterUntil is { + // After events occur and until events occur + Operator [ Periods ] 'after' Clock ev1 'until' Clock ev2 = Periods ] ev1, ev2 ]; + + // Example of function call + Boolean b1 is external; + Boolean b2 is external; + Periods p_after_b1_until_b2 is 'after' new Clock b1 'until' new Clock b2; +}; \ No newline at end of file diff --git a/src/test/resources/testModels/libraries/FORML_test/AfterUntil_no_ext.crml b/src/test/resources/testModels/libraries/FORML_test/AfterUntil_no_ext.crml new file mode 100644 index 0000000..d27bff8 --- /dev/null +++ b/src/test/resources/testModels/libraries/FORML_test/AfterUntil_no_ext.crml @@ -0,0 +1,20 @@ +model AfterUntil_no_ext is { + // After events occur and until events occur + Operator [ Periods ] 'after' Clock ev1 'until' Clock ev2 = Periods ] ev1, ev2 ]; + + // Example of function call + Boolean b1 is + if (2.0 < time and time < 3.5) + or (4.0 < time and time < 5.0) + or (5.5 < time and time < 5.6) + or (16.0 < time) + then true + else false; + Boolean b2 is + if (2.5 < time and time < 5) + or (6.0 < time and time < 7.0) + or (7.5 < time and time < 10.0) + then true + else false; + Periods p_after_b1_until_b2 is 'after' new Clock b1 'until' new Clock b2; +}; \ No newline at end of file diff --git a/src/test/resources/testModels/libraries/FORML_test/FromBefore.crml b/src/test/resources/testModels/libraries/FORML_test/FromBefore.crml new file mode 100644 index 0000000..1d0a2e8 --- /dev/null +++ b/src/test/resources/testModels/libraries/FORML_test/FromBefore.crml @@ -0,0 +1,9 @@ +model FromBefore is { + // From events occur and before events occur + Operator [ Periods ] 'from' Clock ev1 'before' Clock ev2 = new Periods [ ev1, ev2 [; + + // Example of function call + Boolean b1 is external; + Boolean b2 is external; + Periods p_from_b1_before_b2 is 'from' new Clock b1 'before' new Clock b2; +}; \ No newline at end of file diff --git a/src/test/resources/testModels/libraries/FORML_test/FromBefore_no_ext.crml b/src/test/resources/testModels/libraries/FORML_test/FromBefore_no_ext.crml new file mode 100644 index 0000000..f9a5400 --- /dev/null +++ b/src/test/resources/testModels/libraries/FORML_test/FromBefore_no_ext.crml @@ -0,0 +1,20 @@ +model FromBefore_no_ext is { + // From events occur and before events occur + Operator [ Periods ] 'from' Clock ev1 'before' Clock ev2 = new Periods [ ev1, ev2 [; + + // Example of function call + Boolean b1 is + if (2.0 < time and time < 3.5) + or (4.0 < time and time < 5.0) + or (5.5 < time and time < 5.6) + or (16.0 < time) + then true + else false; + Boolean b2 is + if (2.5 < time and time < 5) + or (6.0 < time and time < 7.0) + or (7.5 < time and time < 10.0) + then true + else false; + Periods p_from_b1_before_b2 is 'from' new Clock b1 'before' new Clock b2; +}; \ No newline at end of file diff --git a/src/test/resources/testModels/libraries/FORML_test/FromUntil.crml b/src/test/resources/testModels/libraries/FORML_test/FromUntil.crml new file mode 100644 index 0000000..0b42127 --- /dev/null +++ b/src/test/resources/testModels/libraries/FORML_test/FromUntil.crml @@ -0,0 +1,9 @@ +model FromUntil is { + // From events occur and until events occur + Operator [ Periods ] 'from' Clock ev1 'until' Clock ev2 = new Periods [ ev1, ev2 ]; + + // Example of function call + Boolean b1 is external; + Boolean b2 is external; + Periods p_from_b1_until_b2 is 'from' new Clock b1 'until' new Clock b2; +}; \ No newline at end of file diff --git a/src/test/resources/testModels/libraries/FORML_test/FromUntil_no_ext.crml b/src/test/resources/testModels/libraries/FORML_test/FromUntil_no_ext.crml new file mode 100644 index 0000000..ac51231 --- /dev/null +++ b/src/test/resources/testModels/libraries/FORML_test/FromUntil_no_ext.crml @@ -0,0 +1,20 @@ +model FromUntil_no_ext is { + // From events occur and until events occur + Operator [ Periods ] 'from' Clock ev1 'until' Clock ev2 = new Periods [ ev1, ev2 ]; + + // Example of function call + Boolean b1 is + if (2.0 < time and time < 3.5) + or (4.0 < time and time < 5.0) + or (5.5 < time and time < 5.6) + or (16.0 < time) + then true + else false; + Boolean b2 is + if (2.5 < time and time < 5) + or (6.0 < time and time < 7.0) + or (7.5 < time and time < 10.0) + then true + else false; + Periods p_from_b1_until_b2 is 'from' new Clock b1 'until' new Clock b2; +}; \ No newline at end of file