From bc690c3426afb8e5218009d7ba550f998b40618f Mon Sep 17 00:00:00 2001 From: Hubertus Tummescheit Date: Fri, 12 Jan 2024 12:17:04 -0500 Subject: [PATCH 1/2] Update Continuous.mo Better suggestion to fix init issue for Integrators in Modelica.Blocks.Continuous. WARNING: @MartinOtter, I currently don't have a setup to test this immediately, so this is UNTESTED. Please test before committing. It would be nice to have a test when this is in a loop with a non-linear plant + steady-state initialization. --- Modelica/Blocks/Continuous.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Blocks/Continuous.mo b/Modelica/Blocks/Continuous.mo index bd3b79f9f1..b968d41323 100644 --- a/Modelica/Blocks/Continuous.mo +++ b/Modelica/Blocks/Continuous.mo @@ -21,7 +21,7 @@ package Continuous "Library of continuous control blocks with internal states" Dialog(group="Initialization")); parameter Real y_start=0 "Initial or guess value of output (= state)" annotation (Dialog(group="Initialization")); - extends Interfaces.SISO; + extends Interfaces.SISO(y(start = if initType == Init.SteadyState then y_start), fixed = if initType == Init.SteadyState then false else true); Modelica.Blocks.Interfaces.BooleanInput reset if use_reset "Optional connector of reset signal" annotation(Placement( transformation( extent={{-20,-20},{20,20}}, @@ -144,7 +144,7 @@ port has a rising edge. annotation (Dialog(group="Initialization")); parameter Boolean strict=false "= true, if strict limits with noEvent(..)" annotation (Evaluate=true, choices(checkBox=true), Dialog(tab="Advanced")); - extends Interfaces.SISO; + extends Interfaces.SISO(y(start = if initType == Init.SteadyState then y_start), fixed = if initType == Init.SteadyState then false else true); Modelica.Blocks.Interfaces.BooleanInput reset if use_reset "Optional connector of reset signal" annotation(Placement( transformation( extent={{-20,-20},{20,20}}, From 50eda7495ee8ef7ea5c724344a5da0e5378a20a0 Mon Sep 17 00:00:00 2001 From: Hubertus Tummescheit Date: Fri, 12 Jan 2024 12:30:40 -0500 Subject: [PATCH 2/2] Update Continuous.mo Fixed failed syntax check. --- Modelica/Blocks/Continuous.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Blocks/Continuous.mo b/Modelica/Blocks/Continuous.mo index b968d41323..53e1448da4 100644 --- a/Modelica/Blocks/Continuous.mo +++ b/Modelica/Blocks/Continuous.mo @@ -21,7 +21,7 @@ package Continuous "Library of continuous control blocks with internal states" Dialog(group="Initialization")); parameter Real y_start=0 "Initial or guess value of output (= state)" annotation (Dialog(group="Initialization")); - extends Interfaces.SISO(y(start = if initType == Init.SteadyState then y_start), fixed = if initType == Init.SteadyState then false else true); + extends Interfaces.SISO(y(start = if initType == Init.SteadyState then y_start else 0.0), fixed = if initType == Init.SteadyState then false else true); Modelica.Blocks.Interfaces.BooleanInput reset if use_reset "Optional connector of reset signal" annotation(Placement( transformation( extent={{-20,-20},{20,20}}, @@ -144,7 +144,7 @@ port has a rising edge. annotation (Dialog(group="Initialization")); parameter Boolean strict=false "= true, if strict limits with noEvent(..)" annotation (Evaluate=true, choices(checkBox=true), Dialog(tab="Advanced")); - extends Interfaces.SISO(y(start = if initType == Init.SteadyState then y_start), fixed = if initType == Init.SteadyState then false else true); + extends Interfaces.SISO(y(start = if initType == Init.SteadyState then y_start else 0.0), fixed = if initType == Init.SteadyState then false else true); Modelica.Blocks.Interfaces.BooleanInput reset if use_reset "Optional connector of reset signal" annotation(Placement( transformation( extent={{-20,-20},{20,20}},