Using symbolic variables in control systems

ufechner7
Tue, 06 Feb 2024 14:19:15 +0000
Modelling & Simulations

Is it possible to use symbolic variables when defining a discrete time control system?

The following code fails:

using ControlSystemsBase, ModelingToolkit

@parameters Ts

# Ts = 0.01
Ku = 200/5e6
K2 = 5e6
num = [Ku * Ts]
den = [1, -1]
P = tf(num, den, Ts) # plant

with the error message:

ERROR: LoadError: TypeError: non-boolean (Num) used in boolean context
Stacktrace:
 [1] Discrete
   @ ~/.julia/packages/ControlSystemsBase/4kZY4/src/types/TimeEvolution.jl:9 [inlined]
 [2] Discrete
   @ ~/.julia/packages/ControlSystemsBase/4kZY4/src/types/TimeEvolution.jl:19 [inlined]
 [3] tf(num::Vector{Num}, den::Vector{Int64}, Ts::Num)
   @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/4kZY4/src/types/tf.jl:49
 [4] top-level scope
   @ ~/repos/WindSpeedEstimators/mwes/mwe_09.jl:10
 [5] include(fname::String)
   @ Base.MainInclude ./client.jl:489
 [6] top-level scope
   @ REPL[2]:1
in expression starting at /home/ufechner/repos/WindSpeedEstimators/mwes/mwe_09.jl:10

4 posts - 2 participants