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

Update README

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])
end
end
......@@ -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).
```julia
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)
end
```
`C` must here be represented by a [`StateSpace`](http://juliacontrol.github.io/ControlSystems.jl/latest/lib/constructors/#ControlSystems.ss) type from [`ControlSystems.jl`](https://github.com/JuliaControl/ControlSystems.jl).
`G1` and `G4` must here be represented by [`StateSpace`](http://juliacontrol.github.io/ControlSystems.jl/latest/lib/constructors/#ControlSystems.ss) types from [`ControlSystems.jl`](https://github.com/JuliaControl/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