From 3c88a9ad2f4f1de71f356761ead9d633e5324852 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Mon, 25 Sep 2023 18:14:41 +0200 Subject: [PATCH] avoid using array variable --- src/Blocks/math.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Blocks/math.jl b/src/Blocks/math.jl index 9dc91a600..9fb8ea3af 100644 --- a/src/Blocks/math.jl +++ b/src/Blocks/math.jl @@ -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 @@ -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