diff --git a/IBPSA/Controls/OBC/CDL/Logical/TrueFalseHold.mo b/IBPSA/Controls/OBC/CDL/Logical/TrueFalseHold.mo index 5365adb62d..2f1d576285 100644 --- a/IBPSA/Controls/OBC/CDL/Logical/TrueFalseHold.mo +++ b/IBPSA/Controls/OBC/CDL/Logical/TrueFalseHold.mo @@ -22,7 +22,7 @@ block TrueFalseHold protected /* The following parameter is required solely as a warkaround for a bug in OCT [Modelon - 1263]. Both Dymola and OMC can handle the initial equation pre(u)=u, which complies with MLS. */ - parameter Boolean pre_u_start=false + parameter Boolean pre_u_start=false "Value of pre(u) at initial time" annotation (Evaluate=true); Boolean not_u = not u @@ -49,21 +49,15 @@ equation y = u; entryTimeTrue = if y then time else pre(entryTimeTrue); entryTimeFalse = if not y then time else pre(entryTimeFalse); - /* - The two elsewhen clauses below are kept separate to address an issue - with event handling in the CVODE solver. - */ - elsewhen {edge(u), edge(not_u)} then - y = if time >= pre(entryTimeFalse) + falseHoldDuration and - time >= pre(entryTimeTrue) + trueHoldDuration then u + elsewhen {edge(u), + edge(not_u), + time >= pre(entryTimeFalse) + falseHoldDuration and + time >= pre(entryTimeTrue) + trueHoldDuration} then + y=if time >= pre(entryTimeFalse) + falseHoldDuration and + time >= pre(entryTimeTrue) + trueHoldDuration then u else pre(y); entryTimeTrue = if edge(y) then time else pre(entryTimeTrue); entryTimeFalse = if edge(not_y) then time else pre(entryTimeFalse); - elsewhen time >= pre(entryTimeFalse) + falseHoldDuration and - time >= pre(entryTimeTrue) + trueHoldDuration then - y = u; - entryTimeTrue = if edge(y) then time else pre(entryTimeTrue); - entryTimeFalse = if edge(not_y) then time else pre(entryTimeFalse); end when; annotation ( defaultComponentName="truFalHol", @@ -145,6 +139,12 @@ alt=\"Input and output of the block\"/> revisions="
elsewhen
clauses.