Skip to content
Merged
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
14 changes: 7 additions & 7 deletions src/Blocks/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ end
Gain.f(k; name) = Gain.f(; k, name)

"""
MatrixGain(K::AbstractArray; name)
MatrixGain(; K::AbstractArray, name)

Output the product of a gain matrix with the input signal vector.

# Parameters:
# Structural parameters:

- `K`: Matrix gain

Expand All @@ -38,19 +38,19 @@ Output the product of a gain matrix with the input signal vector.
- `output`
"""
@mtkmodel MatrixGain begin
@parameters begin
K, [description = "Matrix gain"]
@structural_parameters begin
K
end
begin
nout = size(getdefault(K), 1)
nin = size(getdefault(K), 2)
nout = size(K, 1)
nin = size(K, 2)
end
@components begin
input = RealInput(; nin = nin)
output = RealOutput(; nout = nout)
end
@equations begin
[output.u[i] ~ sum(getdefault(K)[i, j] * input.u[j] for j in 1:nin)
[output.u[i] ~ sum(K[i, j] * input.u[j] for j in 1:nin)
for i in 1:nout]...
end
end
Expand Down