From 1ffba03a8f5a5e017c27619852b7692f1acd41f9 Mon Sep 17 00:00:00 2001 From: Michael Wetter Date: Mon, 3 Nov 2025 10:24:22 -0800 Subject: [PATCH] Reformulated initialization This avoid nonlinear equations in when constructs which OpenModelica does not support. For #2064 --- IBPSA/Controls/OBC/CDL/Logical/Latch.mo | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/IBPSA/Controls/OBC/CDL/Logical/Latch.mo b/IBPSA/Controls/OBC/CDL/Logical/Latch.mo index 4b4d8e8a29..b89bc36aa3 100644 --- a/IBPSA/Controls/OBC/CDL/Logical/Latch.mo +++ b/IBPSA/Controls/OBC/CDL/Logical/Latch.mo @@ -10,10 +10,11 @@ block Latch IBPSA.Controls.OBC.CDL.Interfaces.BooleanOutput y "Output with latched signal" annotation (Placement(transformation(extent={{100,-20},{140,20}}))); + +initial equation + y = not clr and u; equation - when initial() then - y=not clr and u; - elsewhen {clr, u} then + when {clr, u} then y=not clr and u; end when; annotation ( @@ -118,6 +119,11 @@ At initial time, if clr = false, then the output will be revisions="