From 23aaa551bb86a926c7b6bdf22fad77f84b962252 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Fri, 12 Jul 2024 16:17:17 +0200 Subject: [PATCH] RFC: Remove zero initialization on Integrator, Derivative, and FirstOrder As started to be discussed in the other thread, these are the only three `= 0` in this package that seem like they have a reasonable argument for it. There is a use case for which the integrator's starting value could be defined by an outside value, in which case this no `= 0` default is better as you will otherwise "accidentally" add an extra initial equation and fail initialization, unless you do `= nothing` (needs to be added). But, is this better for the normal user? --- src/Blocks/continuous.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Blocks/continuous.jl b/src/Blocks/continuous.jl index 81a78aa0a..83c713750 100644 --- a/src/Blocks/continuous.jl +++ b/src/Blocks/continuous.jl @@ -15,12 +15,12 @@ Initial value of integrator state ``x`` can be set with `x` # Unknowns: - - `x`: State of Integrator. Defaults to 0.0. + - `x`: State of Integrator. """ @mtkmodel Integrator begin @extend u, y = siso = SISO() @variables begin - x(t) = 0.0, [description = "State of Integrator"] + x(t), [description = "State of Integrator"] end @parameters begin k = 1, [description = "Gain"] @@ -55,7 +55,7 @@ Initial value of the state ``x`` can be set with `x`. # Unknowns: - - `x`: Unknown of Derivative. Defaults to 0.0. + - `x`: Unknown of Derivative. # Connectors: @@ -65,7 +65,7 @@ Initial value of the state ``x`` can be set with `x`. @mtkmodel Derivative begin @extend u, y = siso = SISO() @variables begin - x(t) = 0.0, [description = "Derivative-filter state"] + x(t), [description = "Derivative-filter state"] end @parameters begin T = T, [description = "Time constant"] @@ -122,7 +122,7 @@ See also [`SecondOrder`](@ref) lowpass = true end @variables begin - x(t) = 0.0, [description = "State of FirstOrder filter"] + x(t), [description = "State of FirstOrder filter"] end @parameters begin T = T, [description = "Time constant"]