From 849f94e3706aec27cd1a828601fdb11a25465f1c Mon Sep 17 00:00:00 2001 From: olero Date: Fri, 19 Apr 2024 13:42:59 +0200 Subject: [PATCH] correct event type --- resources/modelica_libraries/CRMLtoModelica.mo | 16 ++++------------ src/main/java/crml/compiler/OperatorMapping.java | 10 +++++----- src/main/java/crml/compiler/crmlVisitorImpl.java | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/resources/modelica_libraries/CRMLtoModelica.mo b/resources/modelica_libraries/CRMLtoModelica.mo index 1f9fa29..ea88b21 100644 --- a/resources/modelica_libraries/CRMLtoModelica.mo +++ b/resources/modelica_libraries/CRMLtoModelica.mo @@ -36,14 +36,6 @@ end CRMLClock; false4, true4) "4-valued logic" annotation (Icon(graphics = {Text(extent = {{-58, 48}, {76, -38}}, textString = "")}, coordinateSystem(extent = {{-100, -100}, {100, 100}}))); - - record CRMLEvent - - Real occurence_time; - - Boolean occurence_condition; - - end CRMLEvent; record WhileLocator "Description of a while locator" Boolean timePeriod "Represents the different time periods of the time locator"; @@ -61,11 +53,11 @@ end CRMLClock; parameter Boolean isRightBoundaryIncluded=true "If true, the right boundaries of the time periods are included"; public - CRMLtoModelica.Types.CRMLEvent start_event; - CRMLtoModelica.Types.CRMLEvent close_event; + Boolean start_event; + Boolean close_event; - Integer timeOpen; - Integer timeClosed; + Integer timeOpen; + Integer timeClosed; end CRMLPeriod; block CRMLPeriods "Generates multiple time periods" diff --git a/src/main/java/crml/compiler/OperatorMapping.java b/src/main/java/crml/compiler/OperatorMapping.java index 584dff8..f1616aa 100644 --- a/src/main/java/crml/compiler/OperatorMapping.java +++ b/src/main/java/crml/compiler/OperatorMapping.java @@ -246,12 +246,12 @@ public static HashMap> get_operator_map() { // filter operator built_in_operators.put("filter", - Arrays.asList(new Signature("CRMLtoModelica.Blocks.filterC", Arrays.asList("Clock", "Boolean"), params, + Arrays.asList(new Signature("CRMLtoModelica.Blocks.EventFilter", Arrays.asList("Clock", "Boolean"), params, "Clock", Type.BLOCK))); // card operator built_in_operators.put("card", - Arrays.asList(new Signature("CRMLtoModelica.Blocks.cardClock", Arrays.asList("Clock"), params, + Arrays.asList(new Signature("CRMLtoModelica.Blocks.Card", Arrays.asList("Clock"), params, "Integer", Type.BLOCK))); // CONSTRUCTORS TODO finalize constructor table @@ -264,19 +264,19 @@ public static HashMap> get_operator_map() { built_in_operators.put("String", string_sigs); // Integer - List integer_sigs = Arrays.asList(new Signature("Integer", int1, params, "integer", Type.FUNCTION), + List integer_sigs = Arrays.asList(new Signature("Integer", int1, params, "Integer", Type.FUNCTION), new Signature("Integer", real1, params, "integer", Type.FUNCTION)); built_in_operators.put("Integer", integer_sigs); // Real - List real_sigs = Arrays.asList(new Signature("Real", int1, params, "real", Type.FUNCTION), + List real_sigs = Arrays.asList(new Signature("Real", int1, params, "Real", Type.FUNCTION), new Signature("Real", real1, params, "real", Type.FUNCTION)); built_in_operators.put("Real", real_sigs); // Event - List event_sigs = Arrays.asList(new Signature("Event", bool1, params, "CRMLtoModelica.Types.Event", Type.BLOCK)); + List event_sigs = Arrays.asList(new Signature("CRMLtoModelica.Types.Event", bool1, params, "Event", Type.BLOCK)); built_in_operators.put("Event", event_sigs); diff --git a/src/main/java/crml/compiler/crmlVisitorImpl.java b/src/main/java/crml/compiler/crmlVisitorImpl.java index 33fd893..8aeac95 100644 --- a/src/main/java/crml/compiler/crmlVisitorImpl.java +++ b/src/main/java/crml/compiler/crmlVisitorImpl.java @@ -62,7 +62,7 @@ public crmlVisitorImpl (crmlParser parser) { types_mapping.put("Boolean", "CRMLtoModelica.Types.Boolean4"); types_mapping.put("Period", "CRMLtoModelica.Types.CRMLPeriod"); types_mapping.put("Periods", "CRMLtoModelica.Types.CRMLPeriods"); - types_mapping.put("Event", "CRMLtoModelica.Types.Event"); + types_mapping.put("Event", "CRMLtoModelica.Types.Boolean4"); types_mapping.put("Requirement", "CRMLtoModelica.Types.Boolean4"); types_mapping.put("Clock", "CRMLtoModelica.Types.CRMLClock"); types_mapping.put("Real", "Real");