Skip to content

Commit cdbf2a4

Browse files
fix: allow passing gainPI__k to PI component
1 parent d784769 commit cdbf2a4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Blocks/continuous.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,20 @@ U(s) = k (1 + \\dfrac{1}{sT}) E(S)
241241
242242
See also [`LimPI`](@ref)
243243
"""
244-
@component function PI(; name, k = 1.0, T = 1.0)
244+
@component function PI(; name, k = 1.0, T = 1.0, gainPI__k = nothing)
245245
@symcheck T > 0 ||
246246
throw(ArgumentError("Time constant `T` has to be strictly positive"))
247247

248248
pars = @parameters begin
249249
k = k, [description = "Proportional gain"]
250250
T = T, [description = "Integrator time constant"]
251251
end
252-
252+
253+
gainPI__k = @something(gainPI__k, k)
253254
systems = @named begin
254255
err_input = RealInput() # control error
255256
ctr_output = RealOutput() # control signal
256-
gainPI = Gain(; k)
257+
gainPI = Gain(; k = gainPI__k)
257258
addPI = Add()
258259
int = Integrator(k = 1 / T, x = 0.0)
259260
end

0 commit comments

Comments
 (0)