Commit a38c1b06 authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files


parent 44083893
......@@ -54,7 +54,7 @@ for (i,t) = enumerate(0:h:duration)
@periodically h begin
y[i] = measure(P)
r[i] = reference(t)
u[i] = control(i)
u[i] = calc_control(i,y,r)
control(P, u[i])
......@@ -64,13 +64,17 @@ Often one finds the need to implement a stateful controller, i.e., a function
that has a memory or state. To this end, the function [`sysfilter`](@ref) is
provided. This function is used to implement control loops where a signal is
filtered through a dynamical system, i.e., `U(z) = C(z)E(z)`.
Usage is demonstrated below
Usage is demonstrated below, which is a simplified implementation of the block
diagram above (transfer function- and signal names corresponds to the figure).
stateC = init_sysfilter(C)
stateG1 = init_sysfilter(G1)
stateG4 = init_sysfilter(G4)
function control(i)
e = r[i]-y[i]
u = sysfilter!(stateC, C, e)
rf = sysfilter!(stateG4, G4, r)
e = rf-y
u = sysfilter!(stateG1, G1, e)
`C` must here be represented by a [`StateSpace`]( type from [`ControlSystems.jl`](
`G1` and `G4` must here be represented by [`StateSpace`]( types from [`ControlSystems.jl`](
`TransferFunction` types can easily be converted to a `StateSpace` by `Gss = ss(Gtf)`.
Continuous time systems can be discretized using `Gd = c2d(Gc, h)`. (The sample time of a process is available through `h = sampletime(P)`.)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment