From cdbf2a4fd1bcc1308f360f6e098e7cb4ae76c875 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Tue, 27 Jan 2026 17:58:18 +0530 Subject: [PATCH] fix: allow passing `gainPI__k` to `PI` component --- src/Blocks/continuous.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Blocks/continuous.jl b/src/Blocks/continuous.jl index 6e0d2be7..cffc9a66 100644 --- a/src/Blocks/continuous.jl +++ b/src/Blocks/continuous.jl @@ -241,7 +241,7 @@ U(s) = k (1 + \\dfrac{1}{sT}) E(S) See also [`LimPI`](@ref) """ -@component function PI(; name, k = 1.0, T = 1.0) +@component function PI(; name, k = 1.0, T = 1.0, gainPI__k = nothing) @symcheck T > 0 || throw(ArgumentError("Time constant `T` has to be strictly positive")) @@ -249,11 +249,12 @@ See also [`LimPI`](@ref) k = k, [description = "Proportional gain"] T = T, [description = "Integrator time constant"] end - + + gainPI__k = @something(gainPI__k, k) systems = @named begin err_input = RealInput() # control error ctr_output = RealOutput() # control signal - gainPI = Gain(; k) + gainPI = Gain(; k = gainPI__k) addPI = Add() int = Integrator(k = 1 / T, x = 0.0) end