From a38c1b066689a2852277544df3f5db162e723014 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson <cont-frb@ulund.org> Date: Mon, 21 Aug 2017 20:36:49 +0200 Subject: [PATCH] Update README --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 89227ea..60a77df 100644 --- a/README.md +++ b/README.md @@ -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)`.) -- GitLab