Skip to content

Commit

Permalink
build based on f9676d1
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Sep 17, 2024
1 parent 4f14ae0 commit 7c172f8
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dev/advanced/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@

julia&gt; </code></pre><p>A second run of this command needs about 5.5 s which means the startup time (load and compilation time of the package and the libraries) has been reduced to about 18.4s.</p><p>Without a system image the first time execution of the script &quot;simulate_simple.jl&quot; on the same computer is about 71 seconds while the time for the second execution is the same (5.5s). So now about 47s of time are saved after each restart.</p><h2 id="Hints-for-Developers"><a class="docs-heading-anchor" href="#Hints-for-Developers">Hints for Developers</a><a id="Hints-for-Developers-1"></a><a class="docs-heading-anchor-permalink" href="#Hints-for-Developers" title="Permalink"></a></h2><h3 id="Coding-style"><a class="docs-heading-anchor" href="#Coding-style">Coding style</a><a id="Coding-style-1"></a><a class="docs-heading-anchor-permalink" href="#Coding-style" title="Permalink"></a></h3><ul><li><p>add the packages <code>TestEnv</code> and <code>Revise</code> to your global environment, not to any project</p></li><li><p>avoid hard-coded numeric values like <code>9.81</code> in the code, instead define a global constant <code>G_EARTH</code> or read this value from a configuration file</p></li><li><p>stick to a line length limit of 120 characters</p></li><li><p>try to avoid dot operators unless you have to. </p></li></ul><p>Bad: <code>norm1 .~ norm(segment)</code> Good: <code>norm1 ~ norm(segment)</code></p><ul><li>if you need to refer to the settings you can use <code>se()</code> which will load the settings of the active project. To define the active project use a line like <code>set = se(&quot;system_3l.yaml&quot;)</code> at the beginning of your program.</li><li>use the <code>\cdot</code> operator for the dot product for improved readability</li><li>use a space after a comma, e.g. <code>force_eqs[j, i]</code></li><li>enclose operators like <code>+</code> and <code>*</code> in single spaces, like <code>0.5 * (s.pos[s.num_C] + s.pos[s.num_D])</code>; exception: <code>mass_tether_particle[i-1]</code></li><li>try to align the equation signs for improved readability like this:</li></ul><pre><code class="language-julia hljs"> tether_rhs = [force_eqs[j, i].rhs for j in 1:3]
kite_rhs = [force_eqs[j, i+3].rhs for j in 1:3]
f_xy = dot(tether_rhs, e_z) * e_z</code></pre><h2 id="Outlook"><a class="docs-heading-anchor" href="#Outlook">Outlook</a><a id="Outlook-1"></a><a class="docs-heading-anchor-permalink" href="#Outlook" title="Permalink"></a></h2><p>The next steps:</p><ul><li>re-implement the KPS4 model using ModelingToolkit</li><li>add a Matlab/ Simulink wrapper similar to the Python wrapper <a href="https://github.com/ufechner7/pykitemodels">pykitemodels</a></li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../quickstart/">« Quickstart</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Tuesday 17 September 2024 02:41">Tuesday 17 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
f_xy = dot(tether_rhs, e_z) * e_z</code></pre><h2 id="Outlook"><a class="docs-heading-anchor" href="#Outlook">Outlook</a><a id="Outlook-1"></a><a class="docs-heading-anchor-permalink" href="#Outlook" title="Permalink"></a></h2><p>The next steps:</p><ul><li>re-implement the KPS4 model using ModelingToolkit</li><li>add a Matlab/ Simulink wrapper similar to the Python wrapper <a href="https://github.com/ufechner7/pykitemodels">pykitemodels</a></li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../quickstart/">« Quickstart</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Tuesday 17 September 2024 02:58">Tuesday 17 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
8 changes: 4 additions & 4 deletions dev/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
st
&lt;BACKSPACE&gt;</code></pre><p>The command &quot;st&quot; was not really required, but it is useful to display which versions of the packages we have in our project. Another important package manager command is the command &quot;up&quot;, which updates all packages to the latest compatible versions.</p><p>Then, copy the default configuration files and examples to your new project:</p><pre><code class="language-julia hljs">using KiteModels
copy_settings()
copy_examples()</code></pre><p>The first command copies the files settings.yaml and system.yaml to the folder data. They can be customized later. The second command creates an examples folder with some examples.</p><h2 id="Plotting-the-initial-state"><a class="docs-heading-anchor" href="#Plotting-the-initial-state">Plotting the initial state</a><a id="Plotting-the-initial-state-1"></a><a class="docs-heading-anchor-permalink" href="#Plotting-the-initial-state" title="Permalink"></a></h2><p>First, an instance of the model of the kite control unit (KCU) is created which is needed by the Kite Power System model KPS3. Then we create a kps instance, passing the kcu model as parameter. We need to declare these variables as const to achieve a decent performance.</p><pre><code class="language-julia hljs">using KiteModels
const kcu = KCU(se())
const kps = KPS3(kcu)</code></pre><p>Then we call the function <code>find_steady_state</code> which uses a non-linear solver to find the solution for a given elevation angle, reel-out speed and wind speed. </p><pre><code class="language-julia hljs">find_steady_state!(kps, prn=true)</code></pre><p>To plot the result in 2D we extract the vectors of the x and z coordinates of the tether particles with a for loop:</p><pre><code class="language-julia hljs">x = Float64[]
copy_examples()</code></pre><p>The first command copies the files settings.yaml and system.yaml to the folder data. They can be customized later. The second command creates an examples folder with some examples.</p><h2 id="Plotting-the-initial-state"><a class="docs-heading-anchor" href="#Plotting-the-initial-state">Plotting the initial state</a><a id="Plotting-the-initial-state-1"></a><a class="docs-heading-anchor-permalink" href="#Plotting-the-initial-state" title="Permalink"></a></h2><p>First, an instance of the model of the kite control unit (KCU) is created which is needed by the Kite Power System model KPS3. Then we create a kps instance, passing the kcu model as parameter. We need to declare the type these variables to achieve a decent performance.</p><pre><code class="language-julia hljs">using KiteModels
kcu::KCU = KCU(se())
kps::KPS3 = KPS3(kcu)</code></pre><p>Then we call the function <code>find_steady_state</code> which uses a non-linear solver to find the solution for a given elevation angle, reel-out speed and wind speed. </p><pre><code class="language-julia hljs">find_steady_state!(kps, prn=true)</code></pre><p>To plot the result in 2D we extract the vectors of the x and z coordinates of the tether particles with a for loop:</p><pre><code class="language-julia hljs">x = Float64[]
z = Float64[]
for i in 1:length(kps.pos)
push!(x, kps.pos[i][1])
Expand Down Expand Up @@ -50,4 +50,4 @@
3-element StaticArrays.MVector{3, Float64} with indices SOneTo(3):
12.54966091924401
0.0
0.0</code></pre><h2 id="Example-of-reeling-out-the-tether"><a class="docs-heading-anchor" href="#Example-of-reeling-out-the-tether">Example of reeling out the tether</a><a id="Example-of-reeling-out-the-tether-1"></a><a class="docs-heading-anchor-permalink" href="#Example-of-reeling-out-the-tether" title="Permalink"></a></h2><pre><code class="language-julia hljs">include(&quot;examples/reel_out_1p.jl&quot;)</code></pre><p><img src="../reelout_force_1p.png" alt="Reel out 1p model"/></p><p>In this example, we first keep the tether length constant and at 15 s start to reel out the winch with an acceleration of 0.1 m/s². At a set speed below 2.2 m/s the brake of the winch is active, therefore the &quot;jump&quot; in the v_reelout at the beginning of the reel-out phase.</p><p>It is not a real jump, but a high acceleration compared to the acceleration afterward.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../parameters/">« Parameters</a><a class="docs-footer-nextpage" href="../examples_4p/">Examples_4p »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Tuesday 17 September 2024 02:41">Tuesday 17 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0.0</code></pre><h2 id="Example-of-reeling-out-the-tether"><a class="docs-heading-anchor" href="#Example-of-reeling-out-the-tether">Example of reeling out the tether</a><a id="Example-of-reeling-out-the-tether-1"></a><a class="docs-heading-anchor-permalink" href="#Example-of-reeling-out-the-tether" title="Permalink"></a></h2><pre><code class="language-julia hljs">include(&quot;examples/reel_out_1p.jl&quot;)</code></pre><p><img src="../reelout_force_1p.png" alt="Reel out 1p model"/></p><p>In this example, we first keep the tether length constant and at 15 s start to reel out the winch with an acceleration of 0.1 m/s². At a set speed below 2.2 m/s the brake of the winch is active, therefore the &quot;jump&quot; in the v_reelout at the beginning of the reel-out phase.</p><p>It is not a real jump, but a high acceleration compared to the acceleration afterward.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../parameters/">« Parameters</a><a class="docs-footer-nextpage" href="../examples_4p/">Examples_4p »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Tuesday 17 September 2024 02:58">Tuesday 17 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion dev/examples_4p/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
3-element StaticArrays.MVector{3, Float64} with indices SOneTo(3):
12.542508333667467
0.0
0.0</code></pre><h2 id="Example-of-reeling-out-the-tether"><a class="docs-heading-anchor" href="#Example-of-reeling-out-the-tether">Example of reeling out the tether</a><a id="Example-of-reeling-out-the-tether-1"></a><a class="docs-heading-anchor-permalink" href="#Example-of-reeling-out-the-tether" title="Permalink"></a></h2><pre><code class="language-julia hljs">include(&quot;examples/reel_out_4p.jl&quot;)</code></pre><p><img src="../reelout_force_4p.png" alt="Reel out 4p model"/></p><p>In this example, we first keep the tether length constant and at 15 s start to reel out the winch with an acceleration of 0.1 m/s². At a set speed below 2.2 m/s the brake of the winch is active, therefore the &quot;jump&quot; in the v_reelout at the beginning of the reel-out phase.</p><p>It is not a real jump, but a high acceleration compared to the acceleration afterward.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../examples/">« Examples_1p</a><a class="docs-footer-nextpage" href="../quickstart/">Quickstart »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Tuesday 17 September 2024 02:41">Tuesday 17 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0.0</code></pre><h2 id="Example-of-reeling-out-the-tether"><a class="docs-heading-anchor" href="#Example-of-reeling-out-the-tether">Example of reeling out the tether</a><a id="Example-of-reeling-out-the-tether-1"></a><a class="docs-heading-anchor-permalink" href="#Example-of-reeling-out-the-tether" title="Permalink"></a></h2><pre><code class="language-julia hljs">include(&quot;examples/reel_out_4p.jl&quot;)</code></pre><p><img src="../reelout_force_4p.png" alt="Reel out 4p model"/></p><p>In this example, we first keep the tether length constant and at 15 s start to reel out the winch with an acceleration of 0.1 m/s². At a set speed below 2.2 m/s the brake of the winch is active, therefore the &quot;jump&quot; in the v_reelout at the beginning of the reel-out phase.</p><p>It is not a real jump, but a high acceleration compared to the acceleration afterward.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../examples/">« Examples_1p</a><a class="docs-footer-nextpage" href="../quickstart/">Quickstart »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Tuesday 17 September 2024 02:58">Tuesday 17 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 7c172f8

Please sign in to comment.