From e27bdd4e83d90169b4f014308ae4bb6ee21ec710 Mon Sep 17 00:00:00 2001 From: olero Date: Fri, 29 Nov 2024 15:29:24 +0100 Subject: [PATCH] fix example --- resources/modelica_libraries/CRMLtoModelica.mo | 7 +++---- .../spec-doc-examples/BooleanAtEvent_no_ext.crml | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/modelica_libraries/CRMLtoModelica.mo b/resources/modelica_libraries/CRMLtoModelica.mo index b45463e7..7a0c6309 100644 --- a/resources/modelica_libraries/CRMLtoModelica.mo +++ b/resources/modelica_libraries/CRMLtoModelica.mo @@ -1,5 +1,4 @@ package CRMLtoModelica -import CRML.ETL.Types.Boolean4; package Types record CRMLClock @@ -90,7 +89,7 @@ end CRMLClock; CRMLPeriod P; equation - P.is_open = if( CRMLtoModelica.Functions.Event2Boolean (P.start_event) and not CRMLtoModelica.Functions.Event2Boolean (P.close_event))then true else false; + P.is_open = if( (CRMLtoModelica.Functions.Event2Boolean (P.start_event) == Boolean4.true4) and not (CRMLtoModelica.Functions.Event2Boolean (P.close_event)== Boolean4.true4))then true else false; end CRMLPeriod_build; @@ -286,11 +285,11 @@ end cvBooleanToBoolean4; function Event2Boolean input Types.Event e; - output Boolean b; + output Boolean4 b; algorithm - b:=if(e.b == CRMLtoModelica.Types.Boolean4.true4)then true else false; + b:=if(e.b == CRMLtoModelica.Types.Boolean4.true4)then Boolean4.true4 else Boolean4.false4; end Event2Boolean; diff --git a/src/test/resources/testModels/spec-doc-examples/BooleanAtEvent_no_ext.crml b/src/test/resources/testModels/spec-doc-examples/BooleanAtEvent_no_ext.crml index 5fc60b94..5ce03081 100644 --- a/src/test/resources/testModels/spec-doc-examples/BooleanAtEvent_no_ext.crml +++ b/src/test/resources/testModels/spec-doc-examples/BooleanAtEvent_no_ext.crml @@ -1,6 +1,6 @@ model BooleanAtEvent_no_ext is { - Boolean b1 is if 2.5 < time and time < 5 then true else false; - Boolean b is if (2.0 <= time and time < 3.5) or (4.0 <= time and time < 5.5) then true else false; + Boolean b1 is if (2.5 < time) and (time < 5) then true else false; + Boolean b is if ((2.0 <= time) and (time < 3.5)) or ((4.0 <= time) and (time < 5.5)) then true else false; Clock c is new Clock b; Boolean b_at_event is b1 at c; // Should start at false and becomes true at t=4s }; \ No newline at end of file