Skip to content

Commit

Permalink
build based on 3205102
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Sep 14, 2024
1 parent 1e2860a commit 18ec6ec
Show file tree
Hide file tree
Showing 21 changed files with 6,861 additions and 6,703 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-07T10:44:41","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-14T09:13:54","documenter_version":"1.7.0"}}
6 changes: 3 additions & 3 deletions dev/blocks/index.html

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions dev/examples/dc_motor_pi/79716301.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,270 changes: 1,635 additions & 1,635 deletions dev/examples/dc_motor_pi/c2d4a030.svg → dev/examples/dc_motor_pi/9fd477a3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 0 additions & 75 deletions dev/examples/dc_motor_pi/ff0c4871.svg

This file was deleted.

6 changes: 3 additions & 3 deletions dev/examples/dc_motor_pi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
label = "Measurement", title = "DC Motor with Speed Controller")
Plots.plot!(sol.t, sol[ref.output.u], label = "Reference")
p2 = Plots.plot(sol.t, sol[load.tau.u], ylabel = "Disturbance in Nm", label = "")
Plots.plot(p1, p2, layout = (2, 1))</code></pre><img src="ff0c4871.svg" alt="Example block output"/><h2 id="Discrete-time-controller"><a class="docs-heading-anchor" href="#Discrete-time-controller">Discrete-time controller</a><a id="Discrete-time-controller-1"></a><a class="docs-heading-anchor-permalink" href="#Discrete-time-controller" title="Permalink"></a></h2><p>Until now, we have modeled both the physical part of the system, the DC motor, and the control systems, in continuous time. In practice, it is common to implement control systems on a computer operating at a fixed sample rate, i.e, in discrete time. A system containing both continuous-time parts and discrete-time parts is often referred to as a &quot;sampled-data system&quot;, and the ModelingToolkit standard library together with ModelingToolkitSampledData.jl contain several components to model such systems.</p><p>Below, we re-model the system, this time with a discrete-time controller: <a href="../../blocks/#ModelingToolkitSampledData.DiscretePIDStandard"><code>DiscretePIDStandard</code></a>. To interface between the continuous and discrete parts of the model, we make use of a <a href="../../blocks/#ModelingToolkitSampledData.Sampler"><code>Sampler</code></a> and <a href="../../blocks/#ModelingToolkitSampledData.ZeroOrderHold"><code>ZeroOrderHold</code></a> blocks. Apart from the three aforementioned components, the model is the same as before.</p><pre><code class="language-julia hljs">using ModelingToolkitSampledData
Plots.plot(p1, p2, layout = (2, 1))</code></pre><img src="79716301.svg" alt="Example block output"/><h2 id="Discrete-time-controller"><a class="docs-heading-anchor" href="#Discrete-time-controller">Discrete-time controller</a><a id="Discrete-time-controller-1"></a><a class="docs-heading-anchor-permalink" href="#Discrete-time-controller" title="Permalink"></a></h2><p>Until now, we have modeled both the physical part of the system, the DC motor, and the control systems, in continuous time. In practice, it is common to implement control systems on a computer operating at a fixed sample rate, i.e, in discrete time. A system containing both continuous-time parts and discrete-time parts is often referred to as a &quot;sampled-data system&quot;, and the ModelingToolkit standard library together with ModelingToolkitSampledData.jl contain several components to model such systems.</p><p>Below, we re-model the system, this time with a discrete-time controller: <a href="../../blocks/#ModelingToolkitSampledData.DiscretePIDStandard"><code>DiscretePIDStandard</code></a>. To interface between the continuous and discrete parts of the model, we make use of a <a href="../../blocks/#ModelingToolkitSampledData.Sampler"><code>Sampler</code></a> and <a href="../../blocks/#ModelingToolkitSampledData.ZeroOrderHold"><code>ZeroOrderHold</code></a> blocks. Apart from the three aforementioned components, the model is the same as before.</p><pre><code class="language-julia hljs">using ModelingToolkitSampledData
using JuliaSimCompiler

z = ShiftIndex()
Expand Down Expand Up @@ -125,7 +125,7 @@
label = &quot;Measurement (cont. controller)&quot;, title = &quot;DC Motor with Speed Controller&quot;)
Plots.plot!(disc_sol.t, disc_sol[inertia.w], ylabel = &quot;Angular Vel. in rad/s&quot;,
label = &quot;Measurement (disc. controller)&quot;, title = &quot;DC Motor with Discrete-time Speed Controller&quot;, legend=:bottomleft, dpi=600)
lens!([1.2, 1.6], [0.75, 1.02], inset=(1, bbox(.6, .5, .3, .4))) # 1 is subplot index</code></pre><img src="c1fc6a4d.svg" alt="Example block output"/><p>In the plot above, we compare the result of the discrete-time control system to the continuous-time result from before. We see that with the chosen sample-interval of <code>dt=0.005</code> (provided to the <code>Sampler</code> block), we have a slight degradation in the control performance as a consequence of the discretization.</p><h3 id="Adding-a-slower-outer-position-loop"><a class="docs-heading-anchor" href="#Adding-a-slower-outer-position-loop">Adding a slower outer position loop</a><a id="Adding-a-slower-outer-position-loop-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-a-slower-outer-position-loop" title="Permalink"></a></h3><p>Below, we add an outer control loop that controls the position of the motor by manipulating the reference to the inner speed controller. This is a common control strategy, often referred to as <em>cascade control</em>.</p><p><img src="https://help.juliahub.com/juliasimcontrol/dev/figs/cascade_pid.png" alt="block diagram of a cascade control loop"/></p><pre><code class="language-julia hljs">@mtkmodel Cascade begin
lens!([1.2, 1.6], [0.75, 1.02], inset=(1, bbox(.6, .5, .3, .4))) # 1 is subplot index</code></pre><img src="a46e4bbc.svg" alt="Example block output"/><p>In the plot above, we compare the result of the discrete-time control system to the continuous-time result from before. We see that with the chosen sample-interval of <code>dt=0.005</code> (provided to the <code>Sampler</code> block), we have a slight degradation in the control performance as a consequence of the discretization.</p><h3 id="Adding-a-slower-outer-position-loop"><a class="docs-heading-anchor" href="#Adding-a-slower-outer-position-loop">Adding a slower outer position loop</a><a id="Adding-a-slower-outer-position-loop-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-a-slower-outer-position-loop" title="Permalink"></a></h3><p>Below, we add an outer control loop that controls the position of the motor by manipulating the reference to the inner speed controller. This is a common control strategy, often referred to as <em>cascade control</em>.</p><p><img src="https://help.juliahub.com/juliasimcontrol/dev/figs/cascade_pid.png" alt="block diagram of a cascade control loop"/></p><pre><code class="language-julia hljs">@mtkmodel Cascade begin
@components begin
inner = DiscreteClosedLoop(use_ref = false)
sampler = Sampler(clock = Clock(0.005))
Expand Down Expand Up @@ -170,4 +170,4 @@
cascade.cc.u(z-1) =&gt; 0.0;
], (0, 2))
cascade_sol = solve(cascade_prob, Tsit5())
Plots.plot(cascade_sol, idxs = [i.inertia.phi, i.inertia.w, i.zoh.u])</code></pre><img src="c2d4a030.svg" alt="Example block output"/></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../tutorials/noise/">« Noise and measurement corruption</a><a class="docs-footer-nextpage" href="../onoffcontroller/">On-off controller »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Saturday 7 September 2024 10:44">Saturday 7 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Plots.plot(cascade_sol, idxs = [i.inertia.phi, i.inertia.w, i.zoh.u])</code></pre><img src="9fd477a3.svg" alt="Example block output"/></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../tutorials/noise/">« Noise and measurement corruption</a><a class="docs-footer-nextpage" href="../onoffcontroller/">On-off controller »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Saturday 14 September 2024 09:13">Saturday 14 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 18ec6ec

Please sign in to comment.