Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Blocks/continuous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,20 @@ 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used by a test in MTK's downstream

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't that test be updated instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try. I'm not entirely sure why it needs to pass k down to a subcomponent, I just saw the stacktrace and made the PR 😅 .

@symcheck T > 0 ||
throw(ArgumentError("Time constant `T` has to be strictly positive"))

pars = @parameters begin
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
Expand Down
Loading