Skip to content

Commit

Permalink
correct event type
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaRB committed Apr 19, 2024
1 parent cec924c commit 849f94e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
16 changes: 4 additions & 12 deletions resources/modelica_libraries/CRMLtoModelica.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/crml/compiler/OperatorMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ public static HashMap<String, List<Signature>> 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
Expand All @@ -264,19 +264,19 @@ public static HashMap<String, List<Signature>> get_operator_map() {
built_in_operators.put("String", string_sigs);

// Integer
List<Signature> integer_sigs = Arrays.asList(new Signature("Integer", int1, params, "integer", Type.FUNCTION),
List<Signature> 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<Signature> real_sigs = Arrays.asList(new Signature("Real", int1, params, "real", Type.FUNCTION),
List<Signature> 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<Signature> event_sigs = Arrays.asList(new Signature("Event", bool1, params, "CRMLtoModelica.Types.Event", Type.BLOCK));
List<Signature> event_sigs = Arrays.asList(new Signature("CRMLtoModelica.Types.Event", bool1, params, "Event", Type.BLOCK));

built_in_operators.put("Event", event_sigs);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/crml/compiler/crmlVisitorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 849f94e

Please sign in to comment.