ControlSystems.SimulatorMethod
Simulator(P::StateSpace, u = (x,t) -> 0)

Used to simulate continuous-time systems. See function ?solve for additional info.

Usage:

using OrdinaryDiffEq, Plots
dt             = 0.1
tfinal         = 20
t              = 0:dt:tfinal
P              = ss(tf(1,[2,1])^2)
K              = 5
reference(x,t) = [1.]
s              = Simulator(P, reference)
x0             = [0.,0]
tspan          = (0.0,tfinal)
sol            = solve(s, x0, tspan, Tsit5())
plot(t, s.y(sol, t)[:], lab="Open loop step response")
CommonSolve.solveFunction
sol = solve(s::AbstractSimulator, x0, tspan,  args...; kwargs...)

Simulate the system represented by s from initial state x0 over time span tspan = (t0,tf). args and kwargs are sent to the solve function from OrdinaryDiffEq, e.g., solve(s, x0, tspan, Tsit5(), reltol=1e-5) solves the problem with solver Tsit5() and relative tolerance 1e-5.

See also Simulator lsim

ControlSystems._equation_orderMethod
_equation_order(D22)

Internal function. Return a permutation vector that determines the order of evaluation such that each equation is evaluated after all of its dependencies.

ControlSystems.f_lsimMethod
f_lsim(dx, x, p, t)

Internal function: Dynamics equation for simulation of a linear system.

Arguments:

  • dx: State derivative vector written to in place.
  • x: State
  • p: is equal to (A, B, u) where u(x, t) returns the control input
  • t: Time
ControlSystems.hw_fMethod

Internal function. The right-hand side dynamics function for simulation of HammersteinWienerSystem

ControlSystems.rlocusMethod
roots, Z, K = rlocus(P::LTISystem, K = 500)

Compute the root locus of the SISO LTISystem P with a negative feedback loop and feedback gains between 0 and K. rlocus will use an adaptive step-size algorithm to determine the values of the feedback gains used to generate the plot.

roots is a complex matrix containing the poles trajectories of the closed-loop 1+k⋅G(s) as a function of k, Z contains the zeros of the open-loop system G(s) and K the values of the feedback gain.

ControlSystemsBase.lsimMethod
res = lsim(sys::DelayLtiSystem, u, t::AbstractArray{<:Real}; x0=fill(0.0, nstates(sys)), alg=MethodOfSteps(Tsit5()), abstol=1e-6, reltol=1e-6, force_dtmin=true, kwargs...)

Simulate system sys, over time t, using input signal u, with initial state x0, using method alg .

Arguments:

t: Has to be an AbstractVector with equidistant time samples (t[i] - t[i-1] constant) u: Function to determine control signal ut at a time t, on any of the following forms:

  • u: Function to determine control signal uₜ at a time t, on any of the following forms:
    • A constant Number or Vector, interpreted as a constant input.
    • Function u(x, t) that takes the internal state and time, note, the state representation for delay systems is not the same as for rational systems.
    • In-place function u(uₜ, x, t). (Slightly more efficient)

alg, abstol, reltol and kwargs...: are sent to DelayDiffEq.solve.

This methods sets force_dtmin=true by default to handle the discontinuity implied by, e.g., step inputs. This may lead to the solver taking a long time to solve ill-conditioned problems rather than exiting early with a warning.

Returns an instance of SimResult which can be plotted directly or destructured into y, t, x, u = res.

ControlSystemsBase.lsimMethod
lsim(sys::HammersteinWienerSystem, u, t::AbstractArray{<:Real}; x0=fill(0.0, nstates(sys)), alg=Tsit5(), abstol=1e-6, reltol=1e-6, kwargs...)

Simulate system sys, over time t, using input signal u, with initial state x0, using method alg .

Arguments:

  • t: Has to be an AbstractVector with equidistant time samples (t[i] - t[i-1] constant)
  • u: Function to determine control signal uₜ at a time t, on any of the following forms: Can be a constant Number or Vector, interpreted as uₜ .= u , or Function uₜ .= u(x, t), or In-place function u(uₜ, x, t). (Slightly more efficient)
  • alg, abstol, reltol and kwargs...: are sent to OrdinaryDiffEq.solve.

Returns an instance of SimResult.

RecipesBase.apply_recipeMethod
rlocusplot(P::LTISystem; K)

Plot the root locus of the SISO LTISystem P as computed by rlocus.