Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
IfElse = "0.1"
ModelingToolkit = "8"
OffsetArrays = "1"
Symbolics = "0.1, 1, 2, 3, 4"
Symbolics = "4.9"
julia = "1.6"

[extras]
Expand Down
4 changes: 2 additions & 2 deletions src/Blocks/continuous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Critical damping corresponds to `d=1`, which yields the fastest step response wi

# Parameters:
- `k`: Gain
- `w`: Angular frequency
- `w`: [`rad/s`] Angular frequency
- `d`: Damping
- `x_start`: Initial value of state (output)
- `xd_start`: Initial value of derivative of state (output)
Expand Down Expand Up @@ -438,7 +438,7 @@ function StateSpace(; A, B, C, D = nothing, x_start = zeros(size(A, 1)), name)
end
@named input = RealInput(nin = nu)
@named output = RealOutput(nout = ny)
@variables x[1:nx](t) = x_start
@variables x(t)[1:nx] = x_start
# pars = @parameters A=A B=B C=C D=D # This is buggy
eqs = [ # FIXME: if array equations work
[Differential(t)(x[i]) ~ sum(A[i, k] * x[k] for k in 1:nx) +
Expand Down
12 changes: 6 additions & 6 deletions src/Blocks/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if nin == 1
@variables u(t)=u_start [input = true]
else
@variables u[1:nin](t)=u_start [input = true]
@variables u(t)[1:nin]=u_start [input = true]
u = collect(u)
end
ODESystem(Equation[], t, [u...], []; name = name)
Expand All @@ -24,7 +24,7 @@ Connector with one input signal of type Real.
if nout == 1
@variables u(t)=u_start [output = true]
else
@variables u[1:nout](t)=u_start [output = true]
@variables u(t)[1:nout]=u_start [output = true]
u = collect(u)
end
ODESystem(Equation[], t, [u...], []; name = name)
Expand All @@ -45,7 +45,7 @@ Connector with one output signal of type Real.
"""
SISO(;name, u_start=0.0, y_start=0.0)

Single Input Single Output continuous control block.
Single input single output (SISO) continuous system block.

# Parameters:
- `u_start`: Initial value for the input
Expand All @@ -66,7 +66,7 @@ end
"""
MIMO(;name, nin=1, nout=1, u_start=zeros(nin), y_start=zeros(nout))

Base class for a multiple Input multiple Output continuous control block.
Base class for a multiple input multiple output (MIMO) continuous system block.

# Parameters:
- `nin`: Input dimension
Expand All @@ -78,8 +78,8 @@ function MIMO(; name, nin = 1, nout = 1, u_start = zeros(nin), y_start = zeros(n
@named input = RealInput(nin = nin, u_start = u_start)
@named output = RealOutput(nout = nout, u_start = y_start)
@variables begin
u[1:nin](t) = u_start
y[1:nout](t) = y_start
u(t)[1:nin] = u_start
y(t)[1:nout] = y_start
end
eqs = [
[u[i] ~ input.u[i] for i in 1:nin]...,
Expand Down