Skip to content

Commit

Permalink
unary and
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaRB committed May 30, 2024
1 parent 675d3dc commit 2f0b617
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions resources/modelica_libraries/CRMLtoModelica.mo
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ end cvBooleanToBoolean4;
b:=e.b;

end Event2Boolean;



end Functions;

Expand Down Expand Up @@ -370,7 +372,7 @@ end cvBooleanToBoolean4;

input Types.CRMLPeriod r2 ;

input Boolean4 a(start = Types.Boolean4.true4);
input Boolean4 a= Types.Boolean4.true4; //FIXME
output Boolean4 out;
equation
/* Compute the decision event d */
Expand Down Expand Up @@ -497,11 +499,12 @@ end cvBooleanToBoolean4;
</html>"));
end ClockTick;

model CardClock
block CardClock

input CRMLtoModelica.Types.CRMLClock r1;

CRMLtoModelica.Types.CRMLClock r1;
output Integer out(start = 0);

Integer out(start = 0);
equation
out = r1.counter;

Expand Down Expand Up @@ -539,11 +542,25 @@ end cvBooleanToBoolean4;
</html>"));
end BoolTick;

block unaryBoolAnd

input Types.Boolean4 r1;

output Types.Boolean4 out (start = Types.Boolean4.true4);

equation

when (r1 == Types.Boolean4.false4) then
out = Types.Boolean4.false4;
end when;

end unaryBoolAnd;




end Blocks;
annotation(
Icon(graphics = {Ellipse(origin = {5, -2}, fillColor = {0, 143, 0}, fillPattern = FillPattern.Solid, extent = {{-59, 58}, {59, -58}})}));

end CRMLtoModelica;
end CRMLtoModelica;
2 changes: 1 addition & 1 deletion src/main/java/crml/compiler/OperatorMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static HashMap<String, List<Signature>> get_operator_map() {
List<Signature> and_sigs = Arrays.asList(
new Signature("CRMLtoModelica.Functions.and4", bool2, params, "Boolean", Type.FUNCTION),
new Signature("arrayAnd", bool1, params, "Boolean", Type.SET_OP, setUnary, false),
new Signature("unaryBoolAnd", bool1, params, "Boolean", Type.FUNCTION));
new Signature("CRMLtoModelica.Blocks.unaryBoolAnd", bool1, params, "Boolean", Type.BLOCK));
built_in_operators.put("and", and_sigs);

// or operators
Expand Down

0 comments on commit 2f0b617

Please sign in to comment.